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

Unified Diff: test/codegen/language/no_such_method_native_test.dart

Issue 2061373003: implement user-defined nSM, Object members on functions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix Created 4 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
Index: test/codegen/language/no_such_method_native_test.dart
diff --git a/test/codegen/language/no_such_method_native_test.dart b/test/codegen/language/no_such_method_native_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2ef97c00007361932a80473c5bee5b5338e333c9
--- /dev/null
+++ b/test/codegen/language/no_such_method_native_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2016, 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.
+// Dart test program testing that NoSuchMethod is properly called.
+
+import "package:expect/expect.dart";
+
+Invocation invocation;
+
+class C {
+ noSuchMethod(Invocation i) {
+ invocation = i;
+ return 42;
+ }
+}
+
+expectNSME(Object d) {
+ try {
+ d.noSuchMethod(invocation);
+ } on NoSuchMethodError catch (e) {
+ Expect.isTrue(e.toString().contains('foobar'));
+ }
+}
+
+main() {
+ dynamic c = new C();
+ Expect.equals(42, c.foobar(123));
+ Expect.equals(invocation.memberName, #foobar);
+ Expect.listEquals(invocation.positionalArguments, [123]);
+ expectNSME(null);
+ expectNSME(777);
+ expectNSME('hello');
+ // These fail because of https://github.com/dart-lang/dev_compiler/issues/592.
+ // expectNSME([]);
+ // expectNSME(['a', 'b', 'c']);
+}

Powered by Google App Engine
This is Rietveld 408576698