OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class S { | 7 class S { |
8 foo() => "S-foo"; | 8 foo() => "S-foo"; |
9 baz() => "S-baz"; | 9 baz() => "S-baz"; |
10 } | 10 } |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class C = S with M1; | 22 class C = S with M1; |
23 class D = S with M1, M2; | 23 class D = S with M1, M2; |
24 class E = S with M2, M1; | 24 class E = S with M2, M1; |
25 | 25 |
26 class F extends E { | 26 class F extends E { |
27 fez() => "F-fez"; | 27 fez() => "F-fez"; |
28 } | 28 } |
29 | 29 |
30 main() { | 30 main() { |
31 var c = new C(); | 31 dynamic c = new C(); |
32 Expect.equals("S-foo", c.foo()); | 32 Expect.equals("S-foo", c.foo()); |
33 Expect.equals("M1-bar", c.bar()); | 33 Expect.equals("M1-bar", c.bar()); |
34 Expect.equals("S-baz", c.baz()); | 34 Expect.equals("S-baz", c.baz()); |
35 Expect.throws(() => c.fez(), (error) => error is NoSuchMethodError); | 35 Expect.throws(() => c.fez(), (error) => error is NoSuchMethodError); |
36 | 36 |
37 var d = new D(); | 37 var d = new D(); |
38 Expect.equals("S-foo", d.foo()); | 38 Expect.equals("S-foo", d.foo()); |
39 Expect.equals("M2-bar", d.bar()); | 39 Expect.equals("M2-bar", d.bar()); |
40 Expect.equals("M2-baz", d.baz()); | 40 Expect.equals("M2-baz", d.baz()); |
41 Expect.equals("M2-fez", d.fez()); | 41 Expect.equals("M2-fez", d.fez()); |
42 | 42 |
43 var e = new E(); | 43 var e = new E(); |
44 Expect.equals("S-foo", e.foo()); | 44 Expect.equals("S-foo", e.foo()); |
45 Expect.equals("M1-bar", e.bar()); | 45 Expect.equals("M1-bar", e.bar()); |
46 Expect.equals("M2-baz", e.baz()); | 46 Expect.equals("M2-baz", e.baz()); |
47 Expect.equals("M2-fez", e.fez()); | 47 Expect.equals("M2-fez", e.fez()); |
48 | 48 |
49 var f = new F(); | 49 var f = new F(); |
50 Expect.equals("S-foo", f.foo()); | 50 Expect.equals("S-foo", f.foo()); |
51 Expect.equals("M1-bar", f.bar()); | 51 Expect.equals("M1-bar", f.bar()); |
52 Expect.equals("M2-baz", f.baz()); | 52 Expect.equals("M2-baz", f.baz()); |
53 Expect.equals("F-fez", f.fez()); | 53 Expect.equals("F-fez", f.fez()); |
54 } | 54 } |
OLD | NEW |