Index: tests/lib/mirrors/private_symbol_test.dart |
diff --git a/tests/lib/mirrors/private_symbol_test.dart b/tests/lib/mirrors/private_symbol_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ca1041e8c30cbe77a7238cd7e87a156d8e6556d |
--- /dev/null |
+++ b/tests/lib/mirrors/private_symbol_test.dart |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2013, 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; |
+ |
+import 'dart:mirrors'; |
+import 'package:expect/expect.dart'; |
+ |
+main() { |
+ LibraryMirror libcore = currentMirrorSystem().findLibrary(#dart.core).single; |
+ LibraryMirror libmath = currentMirrorSystem().findLibrary(#dart.math).single; |
+ LibraryMirror libtest = currentMirrorSystem().findLibrary(#test).single; |
+ |
+ Symbol corefoo = MirrorSystem.getSymbol('foo', libcore); |
+ Symbol mathfoo = MirrorSystem.getSymbol('foo', libmath); |
+ Symbol testfoo = MirrorSystem.getSymbol('foo', libtest); |
+ |
+ Expect.equals(corefoo, mathfoo); |
+ Expect.equals(mathfoo, testfoo); |
+ Expect.equals(testfoo, corefoo); |
+ |
+ Expect.equals('foo', MirrorSystem.getName(corefoo)); |
+ Expect.equals('foo', MirrorSystem.getName(mathfoo)); |
+ Expect.equals('foo', MirrorSystem.getName(testfoo)); |
+ Expect.equals('foo', MirrorSystem.getName(#foo)); |
+ |
+ Symbol core_foo = MirrorSystem.getSymbol('_foo', libcore); |
+ Symbol math_foo = MirrorSystem.getSymbol('_foo', libmath); |
+ Symbol test_foo = MirrorSystem.getSymbol('_foo', libtest); |
+ |
+ Expect.equals('_foo', MirrorSystem.getName(core_foo)); |
+ Expect.equals('_foo', MirrorSystem.getName(math_foo)); |
+ Expect.equals('_foo', MirrorSystem.getName(test_foo)); |
+ Expect.equals('_foo', MirrorSystem.getName(#_foo)); |
+ |
+ Expect.notEquals(core_foo, math_foo); |
+ Expect.notEquals(math_foo, test_foo); |
+ Expect.notEquals(test_foo, core_foo); |
+ |
+ Expect.notEquals(corefoo, core_foo); |
+ Expect.notEquals(mathfoo, math_foo); |
+ Expect.notEquals(testfoo, test_foo); |
+ |
+ Expect.equals(test_foo, #_foo); |
+} |