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 library mixin_lib_extends_method_test; | 5 library mixin_lib_extends_method_test; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "mixin_lib_extends_method_lib.dart" as L; | 8 import "mixin_lib_extends_method_lib.dart" as L; |
9 | 9 |
10 class S { | 10 class S { |
11 foo() => "S-foo"; | 11 foo() => "S-foo"; |
12 baz() => "S-baz"; | 12 baz() => "S-baz"; |
13 } | 13 } |
14 | 14 |
15 class C extends S with L.M1 {} | 15 class C extends S with L.M1 {} |
16 | 16 |
17 class D extends S with L.M1, L.M2 {} | 17 class D extends S with L.M1, L.M2 {} |
18 | 18 |
19 class E extends S with L.M2, L.M1 {} | 19 class E extends S with L.M2, L.M1 {} |
20 | 20 |
21 class F extends E { | 21 class F extends E { |
22 fez() => "F-fez"; | 22 fez() => "F-fez"; |
23 } | 23 } |
24 | 24 |
25 main() { | 25 main() { |
26 var c = new C(); | 26 dynamic c = new C(); |
27 Expect.equals("S-foo", c.foo()); | 27 Expect.equals("S-foo", c.foo()); |
28 Expect.equals("M1-bar", c.bar()); | 28 Expect.equals("M1-bar", c.bar()); |
29 Expect.equals("S-baz", c.baz()); | 29 Expect.equals("S-baz", c.baz()); |
30 Expect.throws(() => c.fez(), (error) => error is NoSuchMethodError); | 30 Expect.throws(() => c.fez(), (error) => error is NoSuchMethodError); |
31 Expect.equals("sugus", c.clo("su")("gus")); | 31 Expect.equals("sugus", c.clo("su")("gus")); |
32 | 32 |
33 var d = new D(); | 33 var d = new D(); |
34 Expect.equals("S-foo", d.foo()); | 34 Expect.equals("S-foo", d.foo()); |
35 Expect.equals("M2-bar", d.bar()); | 35 Expect.equals("M2-bar", d.bar()); |
36 Expect.equals("M2-baz", d.baz()); | 36 Expect.equals("M2-baz", d.baz()); |
37 Expect.equals("M2-fez", d.fez()); | 37 Expect.equals("M2-fez", d.fez()); |
38 Expect.equals("sugus", d.clo("su")("gus")); | 38 Expect.equals("sugus", d.clo("su")("gus")); |
39 | 39 |
40 var e = new E(); | 40 var e = new E(); |
41 Expect.equals("S-foo", e.foo()); | 41 Expect.equals("S-foo", e.foo()); |
42 Expect.equals("M1-bar", e.bar()); | 42 Expect.equals("M1-bar", e.bar()); |
43 Expect.equals("M2-baz", e.baz()); | 43 Expect.equals("M2-baz", e.baz()); |
44 Expect.equals("M2-fez", e.fez()); | 44 Expect.equals("M2-fez", e.fez()); |
45 Expect.equals("sugus", e.clo("su")("gus")); | 45 Expect.equals("sugus", e.clo("su")("gus")); |
46 | 46 |
47 var f = new F(); | 47 var f = new F(); |
48 Expect.equals("S-foo", f.foo()); | 48 Expect.equals("S-foo", f.foo()); |
49 Expect.equals("M1-bar", f.bar()); | 49 Expect.equals("M1-bar", f.bar()); |
50 Expect.equals("M2-baz", f.baz()); | 50 Expect.equals("M2-baz", f.baz()); |
51 Expect.equals("F-fez", f.fez()); | 51 Expect.equals("F-fez", f.fez()); |
52 Expect.equals("sugus", f.clo("su")("gus")); | 52 Expect.equals("sugus", f.clo("su")("gus")); |
53 } | 53 } |
OLD | NEW |