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

Unified Diff: tests/kernel/unsorted/superclass_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
« no previous file with comments | « tests/kernel/unsorted/super_test.dart ('k') | tests/kernel/unsorted/switch_case_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/kernel/unsorted/superclass_test.dart
diff --git a/tests/kernel/unsorted/superclass_test.dart b/tests/kernel/unsorted/superclass_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ac459c332eb5661c92543607268826476fe053e1
--- /dev/null
+++ b/tests/kernel/unsorted/superclass_test.dart
@@ -0,0 +1,64 @@
+// 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 {
+ A() {
+ print("A");
+ }
+
+ hello() {
+ print("A.hello()");
+ return 1;
+ }
+
+ hello1(a) {
+ print("A.hello1()");
+ print(a);
+ return 1;
+ }
+
+ foo(a, [b]) {
+ print("A.foo()");
+ print(a);
+ print(b);
+ return 1;
+ }
+
+ bar(a, {b}) {
+ print("A.bar()");
+ print(a);
+ print(b);
+ return 1;
+ }
+}
+
+class B extends A {
+ hello() {
+ print("B.hello()");
+ return 2;
+ }
+
+ bar(a, {b}) {
+ print("B.bar()");
+ print(a);
+ print(b);
+ return 2;
+ }
+}
+
+main() {
+ var o = new B();
+
+ // Base class methods.
+ Expect.isTrue(o.hello1(1) == 1);
+ Expect.isTrue(o.foo(1) == 1);
+ Expect.isTrue(o.foo(1, 2) == 1);
+
+ // Overwritten methods.
+ Expect.isTrue(o.hello() == 2);
+ Expect.isTrue(o.bar(1) == 2);
+ Expect.isTrue(o.bar(1, b: 2) == 2);
+}
« no previous file with comments | « tests/kernel/unsorted/super_test.dart ('k') | tests/kernel/unsorted/switch_case_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698