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

Unified Diff: tests/kernel/unsorted/field_dispatcher_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 2 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: tests/kernel/unsorted/field_dispatcher_test.dart
diff --git a/tests/kernel/unsorted/field_dispatcher_test.dart b/tests/kernel/unsorted/field_dispatcher_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..233c341b7a3a8a5a09c06bf0495347385759cb02
--- /dev/null
+++ b/tests/kernel/unsorted/field_dispatcher_test.dart
@@ -0,0 +1,37 @@
+// 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.
+
+import 'expect.dart';
+
+class A {
+ Function fun;
+ A(this.fun);
+}
+
+globalFunctionPositional(int a, [int b = 42]) => a + b;
+
+globalFunctionNamed(int a, {int b: 42}) => a + b;
+
+class Foo {
+ int base;
+
+ Foo(this.base);
+
+ methodFunctionPositional(int a, [int b = 42]) => base + a + b;
+
+ methodFunctionNamed(int a, {int b: 42}) => base + a + b;
+}
+
+main() {
+ Expect.isTrue(new A(globalFunctionPositional).fun(1, 2) == 3);
+ Expect.isTrue(new A(globalFunctionPositional).fun(1) == 43);
+ Expect.isTrue(new A(globalFunctionNamed).fun(1, b: 2) == 3);
+ Expect.isTrue(new A(globalFunctionNamed).fun(1) == 43);
+
+ var foo = new Foo(100);
+ Expect.isTrue(new A(foo.methodFunctionPositional).fun(1, 2) == 103);
+ Expect.isTrue(new A(foo.methodFunctionPositional).fun(1) == 143);
+ Expect.isTrue(new A(foo.methodFunctionNamed).fun(1, b: 2) == 103);
+ Expect.isTrue(new A(foo.methodFunctionNamed).fun(1) == 143);
+}
« no previous file with comments | « tests/kernel/unsorted/factory_regression_test.dart ('k') | tests/kernel/unsorted/finally_contexts_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698