Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: tests/lib/mirrors/private_symbol_test.dart

Issue 24631003: Add proper API for creating private symbols wrt a library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698