Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library MirrorsTest; | 5 library MirrorsTest; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 | 8 |
| 9 import '../../light_unittest.dart'; | 9 import '../../light_unittest.dart'; |
| 10 | 10 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 var methodMirror = libMirror.functions[const Symbol('testNames')]; | 233 var methodMirror = libMirror.functions[const Symbol('testNames')]; |
| 234 var variableMirror = classMirror.variables[const Symbol('field')]; | 234 var variableMirror = classMirror.variables[const Symbol('field')]; |
| 235 | 235 |
| 236 expect(libMirror.simpleName, equals(const Symbol('MirrorsTest'))); | 236 expect(libMirror.simpleName, equals(const Symbol('MirrorsTest'))); |
| 237 expect(libMirror.qualifiedName, equals(const Symbol('MirrorsTest'))); | 237 expect(libMirror.qualifiedName, equals(const Symbol('MirrorsTest'))); |
| 238 | 238 |
| 239 expect(classMirror.simpleName, equals(const Symbol('Class'))); | 239 expect(classMirror.simpleName, equals(const Symbol('Class'))); |
| 240 expect(classMirror.qualifiedName, equals(const Symbol('MirrorsTest.Class'))); | 240 expect(classMirror.qualifiedName, equals(const Symbol('MirrorsTest.Class'))); |
| 241 | 241 |
| 242 TypeVariableMirror typeVariable = classMirror.typeVariables.single; | 242 TypeVariableMirror typeVariable = classMirror.typeVariables.single; |
| 243 expect(typeVariable.simpleName, equals(const Symbol('T'))); | 243 expect(typeVariable.simpleName, equals(const Symbol('T'))); |
|
gbracha
2013/10/16 17:51:26
Can we just use #T (and #MirrorsTest.Class.T below
rmacnak
2013/10/16 23:50:24
Done.
| |
| 244 expect(typeVariable.qualifiedName, | 244 expect(typeVariable.qualifiedName, |
| 245 equals(const Symbol('MirrorsTest.Class.T'))); | 245 equals(const Symbol('MirrorsTest.Class.T'))); |
| 246 | 246 |
| 247 if (!isDart2js) { // TODO(ahe): Implement this in dart2js. | 247 if (!isDart2js) { // TODO(ahe): Implement this in dart2js. |
| 248 expect(typedefMirror.simpleName, equals(const Symbol('Typedef'))); | 248 expect(typedefMirror.simpleName, equals(const Symbol('Typedef'))); |
| 249 expect(typedefMirror.qualifiedName, | 249 expect(typedefMirror.qualifiedName, |
| 250 equals(const Symbol('MirrorsTest.Typedef'))); | 250 equals(const Symbol('MirrorsTest.Typedef'))); |
| 251 | 251 |
| 252 var typedefMirrorDeNovo = reflectClass(Typedef); | 252 var typedefMirrorDeNovo = reflectType(Typedef); |
| 253 expect(typedefMirrorDeNovo.simpleName, equals(const Symbol('Typedef'))); | 253 expect(typedefMirrorDeNovo.simpleName, equals(const Symbol('Typedef'))); |
| 254 expect(typedefMirrorDeNovo.qualifiedName, | 254 expect(typedefMirrorDeNovo.qualifiedName, |
| 255 equals(const Symbol('MirrorsTest.Typedef'))); | 255 equals(const Symbol('MirrorsTest.Typedef'))); |
| 256 } | 256 } |
| 257 | 257 |
| 258 expect(methodMirror.simpleName, equals(const Symbol('testNames'))); | 258 expect(methodMirror.simpleName, equals(const Symbol('testNames'))); |
| 259 expect(methodMirror.qualifiedName, | 259 expect(methodMirror.qualifiedName, |
| 260 equals(const Symbol('MirrorsTest.testNames'))); | 260 equals(const Symbol('MirrorsTest.testNames'))); |
| 261 | 261 |
| 262 expect(variableMirror.simpleName, equals(const Symbol('field'))); | 262 expect(variableMirror.simpleName, equals(const Symbol('field'))); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 282 test("Test current library uri", () { | 282 test("Test current library uri", () { |
| 283 testLibraryUri(new Class(), | 283 testLibraryUri(new Class(), |
| 284 (Uri uri) => uri.path.endsWith('/mirrors_test.dart')); | 284 (Uri uri) => uri.path.endsWith('/mirrors_test.dart')); |
| 285 }); | 285 }); |
| 286 test("Test dart library uri", () { | 286 test("Test dart library uri", () { |
| 287 testLibraryUri("test", (Uri uri) => uri == Uri.parse('dart:core')); | 287 testLibraryUri("test", (Uri uri) => uri == Uri.parse('dart:core')); |
| 288 }); | 288 }); |
| 289 test("Test simple and qualifiedName", () { testNames(mirrors); }); | 289 test("Test simple and qualifiedName", () { testNames(mirrors); }); |
| 290 test("Test reflect type", () { testReflectClass(mirrors); }); | 290 test("Test reflect type", () { testReflectClass(mirrors); }); |
| 291 } | 291 } |
| OLD | NEW |