| Index: runtime/tests/vm/dart/isolate_mirror_local_test.dart
|
| diff --git a/runtime/tests/vm/dart/isolate_mirror_local_test.dart b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
|
| index b07be27c28113281bd8d3cc70270736ab9b80765..9ef77226e86d13903ef0643a57ba194ad4e0043e 100644
|
| --- a/runtime/tests/vm/dart/isolate_mirror_local_test.dart
|
| +++ b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
|
| @@ -124,7 +124,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
|
| lib_mirror.invokeAsync(const Symbol('function'), [123]).then(
|
| (InstanceMirror retval) {
|
| Expect.equals(123, global_var);
|
| - Expect.equals(const Symbol('int'), retval.type.simpleName);
|
| + testImplements(retval.type, #int);
|
| Expect.isTrue(retval.hasReflectee);
|
| Expect.equals(124, retval.reflectee);
|
| testDone('testRootLibraryMirror');
|
| @@ -158,6 +158,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
|
| 'testBoolInstanceMirror, '
|
| 'testCustomInstanceMirror, '
|
| 'testDone, '
|
| + 'testImplements, '
|
| 'testIntegerInstanceMirror, '
|
| 'testLibrariesMap, '
|
| 'testMirrorErrors, '
|
| @@ -196,6 +197,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
|
| 'testBoolInstanceMirror, '
|
| 'testCustomInstanceMirror, '
|
| 'testDone, '
|
| + 'testImplements, '
|
| 'testIntegerInstanceMirror, '
|
| 'testLibrariesMap, '
|
| 'testMirrorErrors, '
|
| @@ -348,8 +350,19 @@ void testMirrorSystem(MirrorSystem mirrors) {
|
| testDone('testMirrorSystem');
|
| }
|
|
|
| +void testImplements(klass, intfName) {
|
| + bool foundInterface = false;
|
| + for (ClassMirror cm = klass; cm != null; cm = cm.superclass) {
|
| + if (cm.simpleName == intfName) foundInterface = true;
|
| + cm.superinterfaces.forEach((intf) {
|
| + if (intf.simpleName == intfName) foundInterface = true;
|
| + });
|
| + }
|
| + Expect.isTrue(foundInterface, '$klass should implement $intfName');
|
| +}
|
| +
|
| void testIntegerInstanceMirror(InstanceMirror mirror) {
|
| - Expect.equals(const Symbol('int'), mirror.type.simpleName);
|
| + testImplements(mirror.type, #int);
|
| Expect.isTrue(mirror.hasReflectee);
|
| Expect.equals(1001, mirror.reflectee);
|
| Expect.equals("InstanceMirror on 1001", mirror.toString());
|
| @@ -357,7 +370,7 @@ void testIntegerInstanceMirror(InstanceMirror mirror) {
|
| // Invoke (mirror + mirror).
|
| mirror.invokeAsync(const Symbol('+'), [ mirror ]).then(
|
| (InstanceMirror retval) {
|
| - Expect.equals(const Symbol('int'), retval.type.simpleName);
|
| + testImplements(retval.type, #int);
|
| Expect.isTrue(retval.hasReflectee);
|
| Expect.equals(2002, retval.reflectee);
|
| testDone('testIntegerInstanceMirror');
|
| @@ -365,7 +378,7 @@ void testIntegerInstanceMirror(InstanceMirror mirror) {
|
| }
|
|
|
| void testStringInstanceMirror(InstanceMirror mirror) {
|
| - Expect.equals(const Symbol('String'), mirror.type.simpleName);
|
| + testImplements(mirror.type, #String);
|
| Expect.isTrue(mirror.hasReflectee);
|
| Expect.equals('This\nis\na\nString', mirror.reflectee);
|
| Expect.equals('InstanceMirror on "This\\nis\\na\\nString"',
|
| @@ -374,7 +387,7 @@ void testStringInstanceMirror(InstanceMirror mirror) {
|
| // Invoke mirror[0].
|
| mirror.invokeAsync(const Symbol('[]'), [ 0 ]).then(
|
| (InstanceMirror retval) {
|
| - Expect.equals(const Symbol('String'), retval.type.simpleName);
|
| + testImplements(retval.type, #String);
|
| Expect.isTrue(retval.hasReflectee);
|
| Expect.equals('T', retval.reflectee);
|
| testDone('testStringInstanceMirror');
|
| @@ -382,7 +395,7 @@ void testStringInstanceMirror(InstanceMirror mirror) {
|
| }
|
|
|
| void testBoolInstanceMirror(InstanceMirror mirror) {
|
| - Expect.equals(const Symbol('bool'), mirror.type.simpleName);
|
| + testImplements(mirror.type, #bool);
|
| Expect.isTrue(mirror.hasReflectee);
|
| Expect.equals(true, mirror.reflectee);
|
| Expect.equals("InstanceMirror on true", mirror.toString());
|
| @@ -390,7 +403,7 @@ void testBoolInstanceMirror(InstanceMirror mirror) {
|
| }
|
|
|
| void testNullInstanceMirror(InstanceMirror mirror) {
|
| - Expect.equals(const Symbol('Null'), mirror.type.simpleName);
|
| + testImplements(mirror.type, #Null);
|
| Expect.isTrue(mirror.hasReflectee);
|
| Expect.equals(null, mirror.reflectee);
|
| Expect.equals("InstanceMirror on null", mirror.toString());
|
| @@ -450,7 +463,7 @@ void testCustomInstanceMirror(InstanceMirror mirror) {
|
| // Invoke mirror.method(1000).
|
| mirror.invokeAsync(const Symbol('method'), [ 1000 ]).then(
|
| (InstanceMirror retval) {
|
| - Expect.equals(const Symbol('int'), retval.type.simpleName);
|
| + testImplements(retval.type, #int);
|
| Expect.isTrue(retval.hasReflectee);
|
| Expect.equals(1017, retval.reflectee);
|
| testDone('testCustomInstanceMirror');
|
|
|