Index: tests/lib/mirrors/library_declarations2_test.dart |
diff --git a/tests/lib/mirrors/library_declarations2_test.dart b/tests/lib/mirrors/library_declarations2_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0167a8d06e41d6b4b0b4dfebadbfe2f5938c619 |
--- /dev/null |
+++ b/tests/lib/mirrors/library_declarations2_test.dart |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library test.library_declarations_test; |
ahe
2014/08/04 09:19:40
For consistency, consider changing name to match f
|
+ |
+@MirrorsUsed(targets: "test.library_declarations_test") |
ahe
2014/08/04 09:19:40
Ditto.
|
+import 'dart:mirrors'; |
+import 'package:expect/expect.dart'; |
+ |
+class A { |
+ static foo() => 499; |
+} |
+ |
+main() { |
+ // Avoid inlining of nested closure. |
+ var targetLibrary = const Symbol("test.library_declarations_test"); |
+ confuse(x) { |
+ if (new DateTime.now().millisecondsSinceEpoch == 0) confuse(x + 1); |
+ if (x != 0) { |
+ Expect.fail("must be 0"); |
+ } |
+ var keys = currentMirrorSystem().findLibrary(targetLibrary).declarations |
+ .keys.toList(); |
+ Expect.equals(2, keys.length); |
+ Expect.isTrue(#A == keys[0] || #main == keys[0]); |
+ Expect.isTrue(#A == keys[1] || #main == keys[1]); |
+ Expect.isTrue(keys[0] != keys[1]); |
+ } |
+ confuse(0); |
+} |