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

Unified Diff: tests/language/mixin_test.dart

Issue 11886097: Get the most basic mixin applications working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Diff against right branch. Created 7 years, 11 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 | « sdk/lib/_internal/compiler/implementation/resolution/resolution.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/mixin_test.dart
diff --git a/tests/language/mixin_test.dart b/tests/language/mixin_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bd819a811f1e76ceb811ee5008e13f8716130791
--- /dev/null
+++ b/tests/language/mixin_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2013, 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.
+
+class S {
+ foo() => "S-foo";
+ baz() => "S-baz";
+}
+
+class M1 {
+ bar() => "M1-bar";
+}
+
+class M2 {
+ bar() => "M2-bar";
+ baz() => "M2-baz";
+}
+
+typedef C = S with M1;
+typedef D = S with M1, M2;
+typedef E = S with M2, M1;
+
+main() {
+ var c = new C();
+ Expect.equals("S-foo", c.foo());
+ Expect.equals("M1-bar", c.bar());
+ Expect.equals("S-baz", c.baz());
+ Expect.isTrue(c is C);
+ Expect.isFalse(c is D);
+ Expect.isFalse(c is E);
+ Expect.isTrue(c is S);
+ Expect.isFalse(c is M1);
+ Expect.isFalse(c is M2);
gbracha 2013/01/17 18:24:20 So per the current spec, c is M1 should be true.
kasperl 2013/01/18 06:21:10 Thanks, Gilad. Done.
+
+ var d = new D();
+ Expect.equals("S-foo", d.foo());
+ Expect.equals("M2-bar", d.bar());
+ Expect.equals("M2-baz", d.baz());
+ Expect.isFalse(d is C);
+ Expect.isTrue(d is D);
+ Expect.isFalse(d is E);
+ Expect.isTrue(d is S);
+ Expect.isFalse(d is M1);
+ Expect.isFalse(d is M2);
+
+ var e = new E();
+ Expect.equals("S-foo", e.foo());
+ Expect.equals("M1-bar", e.bar());
+ Expect.equals("M2-baz", e.baz());
+ Expect.isFalse(e is C);
+ Expect.isFalse(e is D);
+ Expect.isTrue(e is E);
+ Expect.isTrue(e is S);
+ Expect.isFalse(e is M1);
+ Expect.isFalse(e is M2);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/resolution.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698