| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Dart test program for checking implemention of MirrorSystem when | 5 // Dart test program for checking implemention of MirrorSystem when |
| 6 // inspecting the current isolate. | 6 // inspecting the current isolate. |
| 7 // | 7 // |
| 8 // VMOptions=--enable_type_checks | 8 // VMOptions=--enable_type_checks |
| 9 | 9 |
| 10 library isolate_mirror_local_test; | 10 library isolate_mirror_local_test; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return result; | 108 return result; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void testRootLibraryMirror(LibraryMirror lib_mirror) { | 111 void testRootLibraryMirror(LibraryMirror lib_mirror) { |
| 112 Expect.equals(const Symbol('isolate_mirror_local_test'), | 112 Expect.equals(const Symbol('isolate_mirror_local_test'), |
| 113 lib_mirror.simpleName); | 113 lib_mirror.simpleName); |
| 114 Expect.equals(const Symbol('isolate_mirror_local_test'), | 114 Expect.equals(const Symbol('isolate_mirror_local_test'), |
| 115 lib_mirror.qualifiedName); | 115 lib_mirror.qualifiedName); |
| 116 Expect.equals(null, lib_mirror.owner); | 116 Expect.equals(null, lib_mirror.owner); |
| 117 Expect.isFalse(lib_mirror.isPrivate); | 117 Expect.isFalse(lib_mirror.isPrivate); |
| 118 Expect.isTrue(lib_mirror.url.contains('isolate_mirror_local_test.dart')); | 118 Expect.isTrue(lib_mirror.uri.path.contains('isolate_mirror_local_test.dart')); |
| 119 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. | 119 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. |
| 120 // Expect.equals("LibraryMirror on 'isolate_mirror_local_test'", | 120 // Expect.equals("LibraryMirror on 'isolate_mirror_local_test'", |
| 121 // lib_mirror.toString()); | 121 // lib_mirror.toString()); |
| 122 | 122 |
| 123 // Test library invocation by calling function(123). | 123 // Test library invocation by calling function(123). |
| 124 Expect.equals(0, global_var); | 124 Expect.equals(0, global_var); |
| 125 lib_mirror.invokeAsync(const Symbol('function'), [123]).then( | 125 lib_mirror.invokeAsync(const Symbol('function'), [123]).then( |
| 126 (InstanceMirror retval) { | 126 (InstanceMirror retval) { |
| 127 Expect.equals(123, global_var); | 127 Expect.equals(123, global_var); |
| 128 Expect.equals(const Symbol('int'), retval.type.simpleName); | 128 Expect.equals(const Symbol('int'), retval.type.simpleName); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Test that an isolate can reflect on itself. | 535 // Test that an isolate can reflect on itself. |
| 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 537 | 537 |
| 538 testIntegerInstanceMirror(reflect(1001)); | 538 testIntegerInstanceMirror(reflect(1001)); |
| 539 testStringInstanceMirror(reflect('This\nis\na\nString')); | 539 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 540 testBoolInstanceMirror(reflect(true)); | 540 testBoolInstanceMirror(reflect(true)); |
| 541 testNullInstanceMirror(reflect(null)); | 541 testNullInstanceMirror(reflect(null)); |
| 542 testCustomInstanceMirror(reflect(new MyClass(17))); | 542 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 543 testMirrorErrors(currentMirrorSystem()); | 543 testMirrorErrors(currentMirrorSystem()); |
| 544 } | 544 } |
| OLD | NEW |