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

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

Issue 2434123003: Merge more Kernel infrastructure from kernel_sdk SDK fork. (Closed)
Patch Set: 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/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..f7a9b07287212ac55346d104227bb5618ef8f8c4
--- /dev/null
+++ b/tests/kernel/unsorted/superclass_test.dart
@@ -0,0 +1,60 @@
+import 'expect.dart';
Kevin Millikin (Google) 2016/10/21 09:10:58 Copyright header.
Vyacheslav Egorov (Google) 2016/10/21 13:39:44 Done.
+
+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);
+}

Powered by Google App Engine
This is Rietveld 408576698