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 #library('isolate_mirror_local_test'); | 8 #library('isolate_mirror_local_test'); |
9 | 9 |
10 #import('dart:isolate'); | 10 #import('dart:isolate'); |
(...skipping 10 matching lines...) Expand all Loading... |
21 if (expectedTests.isEmpty()) { | 21 if (expectedTests.isEmpty()) { |
22 // All tests are done. | 22 // All tests are done. |
23 exit_port.close(); | 23 exit_port.close(); |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 int global_var = 0; | 27 int global_var = 0; |
28 final int final_global_var = 0; | 28 final int final_global_var = 0; |
29 | 29 |
30 // Top-level getter and setter. | 30 // Top-level getter and setter. |
31 int get myVar() { return 5; } | 31 int get myVar { return 5; } |
32 int set myVar(x) {} | 32 int set myVar(x) {} |
33 | 33 |
34 // This function will be invoked reflectively. | 34 // This function will be invoked reflectively. |
35 int function(int x) { | 35 int function(int x) { |
36 global_var = x; | 36 global_var = x; |
37 return x + 1; | 37 return x + 1; |
38 } | 38 } |
39 | 39 |
40 _stringCompare(String a, String b) => a.compareTo(b); | 40 _stringCompare(String a, String b) => a.compareTo(b); |
41 sort(list) => list.sort(_stringCompare); | 41 sort(list) => list.sort(_stringCompare); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // Test that an isolate can reflect on itself. | 488 // Test that an isolate can reflect on itself. |
489 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 489 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
490 | 490 |
491 testIntegerInstanceMirror(reflect(1001)); | 491 testIntegerInstanceMirror(reflect(1001)); |
492 testStringInstanceMirror(reflect('This\nis\na\nString')); | 492 testStringInstanceMirror(reflect('This\nis\na\nString')); |
493 testBoolInstanceMirror(reflect(true)); | 493 testBoolInstanceMirror(reflect(true)); |
494 testNullInstanceMirror(reflect(null)); | 494 testNullInstanceMirror(reflect(null)); |
495 testCustomInstanceMirror(reflect(new MyClass(17))); | 495 testCustomInstanceMirror(reflect(new MyClass(17))); |
496 testMirrorErrors(currentMirrorSystem()); | 496 testMirrorErrors(currentMirrorSystem()); |
497 } | 497 } |
OLD | NEW |