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

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

Issue 2727323002: Add @MirrorsUsed annotations to speed up tests. (Closed)
Patch Set: Minor fixes. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.mirrors_nsm_mistatch; 5 library test.mirrors_nsm_mismatch;
6 6
7 @MirrorsUsed(targets: "test.mirrors_nsm_mismatch")
7 import 'dart:mirrors'; 8 import 'dart:mirrors';
8 import 'mirrors_nsm_test.dart'; 9 import 'mirrors_nsm_test.dart';
9 10
10 topLevelMethod({missing}) {} 11 topLevelMethod({missing}) {}
11 class C { 12 class C {
12 C.constructor({missing}); 13 C.constructor({missing});
13 factory C.redirecting({missing}) = C.constructor; 14 factory C.redirecting({missing}) = C.constructor;
14 static staticMethod({missing}) {} 15 static staticMethod({missing}) {}
15 instanceMethod({missing}) {} 16 instanceMethod({missing}) {}
16 } 17 }
17 18
18 main() { 19 main() {
19 var mirrors = currentMirrorSystem(); 20 var mirrors = currentMirrorSystem();
20 var libMirror = mirrors.findLibrary(#test.mirrors_nsm_mistatch); 21 var libMirror = mirrors.findLibrary(#test.mirrors_nsm_mismatch);
21 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, [], {#extra: 1}), 22 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, [], {#extra: 1}),
22 () => topLevelMethod(extra: 1)); 23 () => topLevelMethod(extra: 1));
23 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, ['positional']), 24 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, ['positional']),
24 () => topLevelMethod('positional')); 25 () => topLevelMethod('positional'));
25 26
26 var classMirror = reflectClass(C); 27 var classMirror = reflectClass(C);
27 expectMatchingErrors(() => classMirror.newInstance(#constructor, [], 28 expectMatchingErrors(() => classMirror.newInstance(#constructor, [],
28 {#extra: 1}), 29 {#extra: 1}),
29 () => new C.constructor(extra: 1)); 30 () => new C.constructor(extra: 1));
30 expectMatchingErrors(() => classMirror.newInstance(#redirecting, [], 31 expectMatchingErrors(() => classMirror.newInstance(#redirecting, [],
(...skipping 14 matching lines...) Expand all
45 46
46 var instanceMirror = reflect(new C.constructor()); 47 var instanceMirror = reflect(new C.constructor());
47 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod, [], 48 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod, [],
48 {#extra: 1}), 49 {#extra: 1}),
49 () => instanceMirror.reflectee.instanceMethod(extra: 1)); 50 () => instanceMirror.reflectee.instanceMethod(extra: 1));
50 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod, 51 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod,
51 ['positional']), 52 ['positional']),
52 () => instanceMirror.reflectee 53 () => instanceMirror.reflectee
53 .instanceMethod('positional')); 54 .instanceMethod('positional'));
54 } 55 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/mirror_in_static_init_test.dart ('k') | tests/lib/mirrors/mirrors_nsm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698