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

Side by Side Diff: tests/compiler/dart2js_native/native_mixin_multiple_test.dart

Issue 12079020: Extends native mixin tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/native_mixin_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that native classes can use ordinary Dart classes as mixins.
6
7 class A native "*A" {
8 foo() => "A-foo";
9 baz() => "A-baz";
10 }
11
12 class B extends A with M1, M2 native "*B" {
13 bar() => baz();
14 }
15
16 class M1 {
17 foo() => "M1-foo";
18 baz() => "M1-baz";
19 }
20
21 class M2 {
22 foo() => "M2-foo";
23 }
24
25 A makeA() native;
26 B makeB() native;
27
28 void setup() native """
29 function A() {}
30 function B() {}
31 makeA = function(){return new A;};
32 makeB = function(){return new B;};
33 """;
34
35 main() {
36 setup();
37 A a = makeA();
38 Expect.equals("A-foo", a.foo());
39 Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError);
40 Expect.equals("A-baz", a.baz());
41 Expect.isTrue(a is A);
42 Expect.isFalse(a is B);
43 Expect.isFalse(a is M1);
44 Expect.isFalse(a is M2);
45
46 B b = makeB();
47 Expect.equals("M2-foo", b.foo());
48 Expect.equals("M1-baz", b.bar());
49 Expect.equals("M1-baz", b.baz());
50 Expect.isTrue(b is A);
51 Expect.isTrue(b is B);
52 Expect.isTrue(b is M1);
53 Expect.isTrue(b is M2);
54
55 M1 m1 = new M1();
56 Expect.equals("M1-foo", m1.foo());
57 Expect.throws(() => m1.bar(), (error) => error is NoSuchMethodError);
58 Expect.equals("M1-baz", m1.baz());
59 Expect.isFalse(m1 is A);
60 Expect.isFalse(m1 is B);
61 Expect.isTrue(m1 is M1);
62 Expect.isFalse(m1 is M2);
63
64 M2 m2 = new M2();
65 Expect.equals("M2-foo", m2.foo());
66 Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError);
67 Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError);
68 Expect.isFalse(m2 is A);
69 Expect.isFalse(m2 is B);
70 Expect.isFalse(m2 is M1);
71 Expect.isTrue(m2 is M2);
72 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/native_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698