OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library test; |
| 6 |
| 7 import 'dart:mirrors'; |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 main() { |
| 11 LibraryMirror libcore = currentMirrorSystem().findLibrary(#dart.core).single; |
| 12 LibraryMirror libmath = currentMirrorSystem().findLibrary(#dart.math).single; |
| 13 LibraryMirror libtest = currentMirrorSystem().findLibrary(#test).single; |
| 14 |
| 15 Symbol corefoo = MirrorSystem.getSymbol('foo', libcore); |
| 16 Symbol mathfoo = MirrorSystem.getSymbol('foo', libmath); |
| 17 Symbol testfoo = MirrorSystem.getSymbol('foo', libtest); |
| 18 |
| 19 Expect.equals(corefoo, mathfoo); |
| 20 Expect.equals(mathfoo, testfoo); |
| 21 Expect.equals(testfoo, corefoo); |
| 22 |
| 23 Expect.equals('foo', MirrorSystem.getName(corefoo)); |
| 24 Expect.equals('foo', MirrorSystem.getName(mathfoo)); |
| 25 Expect.equals('foo', MirrorSystem.getName(testfoo)); |
| 26 Expect.equals('foo', MirrorSystem.getName(#foo)); |
| 27 |
| 28 Symbol core_foo = MirrorSystem.getSymbol('_foo', libcore); |
| 29 Symbol math_foo = MirrorSystem.getSymbol('_foo', libmath); |
| 30 Symbol test_foo = MirrorSystem.getSymbol('_foo', libtest); |
| 31 |
| 32 Expect.equals('_foo', MirrorSystem.getName(core_foo)); |
| 33 Expect.equals('_foo', MirrorSystem.getName(math_foo)); |
| 34 Expect.equals('_foo', MirrorSystem.getName(test_foo)); |
| 35 Expect.equals('_foo', MirrorSystem.getName(#_foo)); |
| 36 |
| 37 Expect.notEquals(core_foo, math_foo); |
| 38 Expect.notEquals(math_foo, test_foo); |
| 39 Expect.notEquals(test_foo, core_foo); |
| 40 |
| 41 Expect.notEquals(corefoo, core_foo); |
| 42 Expect.notEquals(mathfoo, math_foo); |
| 43 Expect.notEquals(testfoo, test_foo); |
| 44 |
| 45 Expect.equals(test_foo, #_foo); |
| 46 } |
OLD | NEW |