| 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 import "dart:mirrors"; | 6 import "dart:mirrors"; |
| 7 import "../../../pkg/unittest/lib/unittest.dart"; | 7 import "../../../pkg/unittest/lib/unittest.dart"; |
| 8 | 8 |
| 9 bool isDart2js = false; // TODO(ahe): Remove this field. | 9 bool isDart2js = false; // TODO(ahe): Remove this field. |
| 10 bool isMinified = false; // TODO(ahe): Remove this field. | 10 bool isMinified = false; // TODO(ahe): Remove this field. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 if (!isDart2js) { // TODO(ahe): Implement this in dart2js. | 248 if (!isDart2js) { // TODO(ahe): Implement this in dart2js. |
| 249 TypeVariableMirror typeVariable = classMirror.typeVariables.values.single; | 249 TypeVariableMirror typeVariable = classMirror.typeVariables.values.single; |
| 250 expect(typeVariable.simpleName, equals(const Symbol('T'))); | 250 expect(typeVariable.simpleName, equals(const Symbol('T'))); |
| 251 expect(typeVariable.qualifiedName, | 251 expect(typeVariable.qualifiedName, |
| 252 equals(const Symbol('MirrorsTest.Class.T'))); | 252 equals(const Symbol('MirrorsTest.Class.T'))); |
| 253 | 253 |
| 254 expect(typedefMirror.simpleName, equals(const Symbol('Typedef'))); | 254 expect(typedefMirror.simpleName, equals(const Symbol('Typedef'))); |
| 255 expect(typedefMirror.qualifiedName, | 255 expect(typedefMirror.qualifiedName, |
| 256 equals(const Symbol('MirrorsTest.Typedef'))); | 256 equals(const Symbol('MirrorsTest.Typedef'))); |
| 257 |
| 258 var typedefMirrorDeNovo = reflectClass(Typedef); |
| 259 expect(typedefMirrorDeNovo.simpleName, equals(const Symbol('Typedef'))); |
| 260 expect(typedefMirrorDeNovo.qualifiedName, |
| 261 equals(const Symbol('MirrorsTest.Typedef'))); |
| 257 } | 262 } |
| 258 | 263 |
| 259 expect(methodMirror.simpleName, equals(const Symbol('testNames'))); | 264 expect(methodMirror.simpleName, equals(const Symbol('testNames'))); |
| 260 expect(methodMirror.qualifiedName, | 265 expect(methodMirror.qualifiedName, |
| 261 equals(const Symbol('MirrorsTest.testNames'))); | 266 equals(const Symbol('MirrorsTest.testNames'))); |
| 262 | 267 |
| 263 expect(variableMirror.simpleName, equals(const Symbol('field'))); | 268 expect(variableMirror.simpleName, equals(const Symbol('field'))); |
| 264 expect(variableMirror.qualifiedName, | 269 expect(variableMirror.qualifiedName, |
| 265 equals(const Symbol('MirrorsTest.Class.field'))); | 270 equals(const Symbol('MirrorsTest.Class.field'))); |
| 266 } | 271 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 283 test("Test current library uri", () { | 288 test("Test current library uri", () { |
| 284 testLibraryUri(new Class(), | 289 testLibraryUri(new Class(), |
| 285 (Uri uri) => uri.path.endsWith('/mirrors_test.dart')); | 290 (Uri uri) => uri.path.endsWith('/mirrors_test.dart')); |
| 286 }); | 291 }); |
| 287 test("Test dart library uri", () { | 292 test("Test dart library uri", () { |
| 288 testLibraryUri("test", (Uri uri) => uri == Uri.parse('dart:core')); | 293 testLibraryUri("test", (Uri uri) => uri == Uri.parse('dart:core')); |
| 289 }); | 294 }); |
| 290 test("Test simple and qualifiedName", () { testNames(mirrors); }); | 295 test("Test simple and qualifiedName", () { testNames(mirrors); }); |
| 291 test("Test reflect type", () { testReflectClass(mirrors); }); | 296 test("Test reflect type", () { testReflectClass(mirrors); }); |
| 292 } | 297 } |
| OLD | NEW |