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

Unified Diff: tests/lib/mirrors/mirrors_nsm_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/mirrors/mirrors_nsm_mismatch_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/mirrors_nsm_test.dart
diff --git a/tests/lib/mirrors/mirrors_nsm_test.dart b/tests/lib/mirrors/mirrors_nsm_test.dart
index f1abaa76605e747b3444a47a1bb7373da51fbfe1..2364f925b185781a6dc5434d51079984792ca2c5 100644
--- a/tests/lib/mirrors/mirrors_nsm_test.dart
+++ b/tests/lib/mirrors/mirrors_nsm_test.dart
@@ -20,6 +20,10 @@ class A {
final finalInstance = 0;
static final finalStatic = 0;
}
+class B {
+ B(a, b);
+ factory B.fac(a, b) => new B(a, b);
+}
testMessageContents() {
var mirrors = currentMirrorSystem();
@@ -61,14 +65,18 @@ expectMatchingErrors(reflectiveAction, baseAction) {
} catch(e) {
reflectiveError = e;
}
+
try {
baseAction();
} catch(e) {
baseError = e;
}
- print("\n==Base==\n $baseError");
- print("\n==Reflective==\n $reflectiveError");
- Expect.stringEquals(baseError.toString(), reflectiveError.toString());
+
+ if (baseError.toString() != reflectiveError.toString()) {
+ print("\n==Base==\n $baseError");
+ print("\n==Reflective==\n $reflectiveError");
+ throw "Expected matching errors";
+ }
}
testMatchingMessages() {
@@ -92,6 +100,8 @@ testMatchingMessages() {
() => A.foo= null);
expectMatchingErrors(() => classMirror.setField(#finalStatic, null),
() => A.finalStatic= null);
+ expectMatchingErrors(() => classMirror.newInstance(#constructor, [1, 2, 3]),
+ () => new A.constructor(1, 2, 3));
var instanceMirror = reflect(new A());
expectMatchingErrors(() => instanceMirror.invoke(#foo, []),
« no previous file with comments | « tests/lib/mirrors/mirrors_nsm_mismatch_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698