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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/mirrors_nsm_mismatch_test.dart
diff --git a/tests/lib/mirrors/mirrors_nsm_mismatch_test.dart b/tests/lib/mirrors/mirrors_nsm_mismatch_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5c63ca1dfc266914a28c9668bd1db9bb05ab043c
--- /dev/null
+++ b/tests/lib/mirrors/mirrors_nsm_mismatch_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.mirrors_nsm_mistatch;
+
+import 'dart:mirrors';
+import 'mirrors_nsm_test.dart';
+
+topLevelMethod({missing}) {}
+class C {
+ C.constructor({missing});
+ factory C.redirecting({missing}) = C.constructor;
+ static staticMethod({missing}) {}
+ instanceMethod({missing}) {}
+}
+
+main() {
+ var mirrors = currentMirrorSystem();
+ var libMirror = mirrors.findLibrary(#test.mirrors_nsm_mistatch);
+ expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, [], {#extra: 1}),
+ () => topLevelMethod(extra: 1));
+ expectMatchingErrors(() => libMirror.invoke(#topLevelMethod, ['positional']),
+ () => topLevelMethod('positional'));
+
+ var classMirror = reflectClass(C);
+ expectMatchingErrors(() => classMirror.newInstance(#constructor, [],
+ {#extra: 1}),
+ () => new C.constructor(extra: 1));
+ expectMatchingErrors(() => classMirror.newInstance(#redirecting, [],
+ {#extra: 1}),
+ () => new C.redirecting(extra: 1));
+ expectMatchingErrors(() => classMirror.invoke(#staticMethod, [],
+ {#extra: 1}),
+ () => C.staticMethod(extra: 1));
+ expectMatchingErrors(() => classMirror.newInstance(#constructor,
+ ['positional']),
+ () => new C.constructor('positional'));
+ expectMatchingErrors(() => classMirror.newInstance(#redirecting,
+ ['positional']),
+ () => new C.redirecting('positional'));
+ expectMatchingErrors(() => classMirror.invoke(#staticMethod,
+ ['positional']),
+ () => C.staticMethod('positional'));
+
+ var instanceMirror = reflect(new C.constructor());
+ expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod, [],
+ {#extra: 1}),
+ () => instanceMirror.reflectee.instanceMethod(extra: 1));
+ expectMatchingErrors(() => instanceMirror.invoke(#instanceMethod,
+ ['positional']),
+ () => instanceMirror.reflectee
+ .instanceMethod('positional'));
+}
« 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