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

Side by Side Diff: tests/lib/mirrors/metadata_test.dart

Issue 64793003: Update mirror tests for removed API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 test.metadata_test; 5 library test.metadata_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 const string = 'a metadata string'; 9 const string = 'a metadata string';
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (MirrorSystem.getName(symbol) != 'symbol') { 47 if (MirrorSystem.getName(symbol) != 'symbol') {
48 // This happened in dart2js due to how early library metadata is 48 // This happened in dart2js due to how early library metadata is
49 // computed. 49 // computed.
50 throw 'Bad constant: $symbol'; 50 throw 'Bad constant: $symbol';
51 } 51 }
52 52
53 MirrorSystem mirrors = currentMirrorSystem(); 53 MirrorSystem mirrors = currentMirrorSystem();
54 ClassMirror myClassMirror = reflectClass(MyClass); 54 ClassMirror myClassMirror = reflectClass(MyClass);
55 checkMetadata(myClassMirror, [symbol, string]); 55 checkMetadata(myClassMirror, [symbol, string]);
56 LibraryMirror lib = mirrors.findLibrary(#test.metadata_test); 56 LibraryMirror lib = mirrors.findLibrary(#test.metadata_test);
57 MethodMirror function = lib.functions[#main]; 57 MethodMirror function = lib.declarations[#main];
58 checkMetadata(function, [symbol, string, symbol]); 58 checkMetadata(function, [symbol, string, symbol]);
59 MethodMirror method = myClassMirror.methods[#myMethod]; 59 MethodMirror method = myClassMirror.declarations[#myMethod];
60 checkMetadata(method, [string, symbol, string]); 60 checkMetadata(method, [string, symbol, string]);
61 method = myClassMirror.methods[#myOtherMethod]; 61 method = myClassMirror.declarations[#myOtherMethod];
62 checkMetadata(method, []); 62 checkMetadata(method, []);
63 63
64 VariableMirror xMirror = myClassMirror.variables[#x]; 64 VariableMirror xMirror = myClassMirror.declarations[#x];
65 checkMetadata(xMirror, [hest, hest, symbol]); 65 checkMetadata(xMirror, [hest, hest, symbol]);
66 66
67 VariableMirror yMirror = myClassMirror.variables[#y]; 67 VariableMirror yMirror = myClassMirror.declarations[#y];
68 checkMetadata(yMirror, []); 68 checkMetadata(yMirror, []);
69 69
70 // TODO(ahe): Test local functions. 70 // TODO(ahe): Test local functions.
71 } 71 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/metadata_constructed_constant_test.dart ('k') | tests/lib/mirrors/method_mirror_properties_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698