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_is_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: Fix checked mode. 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
Index: tests/language/mixin_is_test.dart
diff --git a/tests/language/mixin_is_test.dart b/tests/language/mixin_is_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2d61ab903b3388f9cd1f8b313a02de1a5485d224
--- /dev/null
+++ b/tests/language/mixin_is_test.dart
@@ -0,0 +1,77 @@
+// 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 { }
+class M1 { }
+class M2 { }
+
+typedef C = S with M1;
+typedef D = S with M1, M2;
+typedef E = S with M2, M1;
+class F extends E { }
+
+typedef C_ = S with M1;
+typedef D_ = S with M1, M2;
+typedef E_ = S with M2, M1;
+class F_ extends E_ { }
+
+main() {
+ var c = new C();
+ Expect.isTrue(c is C);
+ Expect.isFalse(c is D);
+ Expect.isFalse(c is E);
+ Expect.isFalse(c is F);
+ Expect.isTrue(c is S);
+ Expect.isTrue(c is M1);
+ Expect.isFalse(c is M2);
+
+ var d = new D();
+ Expect.isFalse(d is C);
+ Expect.isTrue(d is D);
+ Expect.isFalse(d is E);
+ Expect.isFalse(d is F);
+ Expect.isTrue(d is S);
+ Expect.isTrue(d is M1);
+ Expect.isTrue(d is M2);
+
+ var e = new E();
+ Expect.isFalse(e is C);
+ Expect.isFalse(e is D);
+ Expect.isTrue(e is E);
+ Expect.isFalse(e is F);
+ Expect.isTrue(e is S);
+ Expect.isTrue(e is M1);
+ Expect.isTrue(e is M2);
+
+ var f = new F();
+ Expect.isFalse(f is C);
+ Expect.isFalse(f is D);
+ Expect.isTrue(f is E);
+ Expect.isTrue(f is F);
+ Expect.isTrue(f is S);
+ Expect.isTrue(f is M1);
+ Expect.isTrue(f is M2);
+
+ // Make sure we get a new class for each mixin
+ // application (at least the named ones).
+ Expect.isFalse(c is C_);
+ Expect.isFalse(c is D_);
+ Expect.isFalse(c is E_);
+ Expect.isFalse(c is F_);
+
+ Expect.isFalse(d is C_);
+ Expect.isFalse(d is D_);
+ Expect.isFalse(d is E_);
+ Expect.isFalse(d is F_);
+
+ Expect.isFalse(e is C_);
+ Expect.isFalse(e is D_);
+ Expect.isFalse(e is E_);
+ Expect.isFalse(e is F_);
+
+ Expect.isFalse(f is C_);
+ Expect.isFalse(f is D_);
+ Expect.isFalse(f is E_);
+ Expect.isFalse(f is F_);
+}

Powered by Google App Engine
This is Rietveld 408576698