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

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

Issue 1182613004: Fix reflective NoSuchMethodErrors to match their non-reflective counter parts when due to argument … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/mirrors_nsm_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library test.mirrors_nsm_mistatch;
6
7 import 'dart:mirrors';
8 import 'mirrors_nsm_test.dart';
9
10 topLevelMethod({missing}) {}
11 class C {
12 C.constructor({missing});
13 factory C.redirecting({missing}) = C.constructor;
14 static staticMethod({missing}) {}
15 instanceMethod({missing}) {}
16 }
17
18 main() {
19 var mirrors = currentMirrorSystem();
20 var libMirror = mirrors.findLibrary(#test.mirrors_nsm_mistatch);
21 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, [], {#extra: 1}),
22 () => topLevelMethod(extra: 1));
23 expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, ['positional']),
24 () => topLevelMethod('positional'));
25
26 var classMirror = reflectClass(C);
27 expectMatchingErrors(() => classMirror.newInstance(#constructor, [],
28 {#extra: 1}),
29 () => new C.constructor(extra: 1));
30 expectMatchingErrors(() => classMirror.newInstance(#redirecting, [],
31 {#extra: 1}),
32 () => new C.redirecting(extra: 1));
33 expectMatchingErrors(() => classMirror.invoke(#staticMethod, [],
34 {#extra: 1}),
35 () => C.staticMethod(extra: 1));
36 expectMatchingErrors(() => classMirror.newInstance(#constructor,
37 ['positional']),
38 () => new C.constructor('positional'));
39 expectMatchingErrors(() => classMirror.newInstance(#redirecting,
40 ['positional']),
41 () => new C.redirecting('positional'));
42 expectMatchingErrors(() => classMirror.invoke(#staticMethod,
43 ['positional']),
44 () => C.staticMethod('positional'));
45
46 var instanceMirror = reflect(new C.constructor());
47 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod, [],
48 {#extra: 1}),
49 () => instanceMirror.reflectee.instanceMethod(extra: 1));
50 expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod,
51 ['positional']),
52 () => instanceMirror.reflectee
53 .instanceMethod('positional'));
54 }
OLDNEW
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/mirrors_nsm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698