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 var foo = "S-foo"; | 8 var foo = "S-foo"; |
9 } | 9 } |
10 | 10 |
11 class M1 { | 11 class M1 { |
12 final bar = "M1-bar"; | 12 final bar = "M1-bar"; |
13 } | 13 } |
14 | 14 |
15 class M2 { | 15 class M2 { |
16 var baz = "M2-baz"; | 16 var baz = "M2-baz"; |
17 } | 17 } |
18 | 18 |
19 class C extends S with M1 {} | 19 class C extends S with M1 {} |
20 | 20 |
21 class D extends S with M1, M2 {} | 21 class D extends S with M1, M2 {} |
22 | 22 |
23 class E extends S with M2, M1 {} | 23 class E extends S with M2, M1 {} |
24 | 24 |
25 class F extends E { | 25 class F extends E { |
26 var fez = "F-fez"; | 26 var fez = "F-fez"; |
27 } | 27 } |
28 | 28 |
29 main() { | 29 main() { |
30 var c = new C(); | 30 dynamic c = new C(); |
31 var d = new D(); | 31 dynamic d = new D(); |
32 var e = new E(); | 32 dynamic e = new E(); |
33 var f = new F(); | 33 dynamic f = new F(); |
34 | 34 |
35 Expect.equals("S-foo", c.foo); | 35 Expect.equals("S-foo", c.foo); |
36 Expect.equals("S-foo", d.foo); | 36 Expect.equals("S-foo", d.foo); |
37 Expect.equals("S-foo", e.foo); | 37 Expect.equals("S-foo", e.foo); |
38 Expect.equals("S-foo", f.foo); | 38 Expect.equals("S-foo", f.foo); |
39 | 39 |
40 Expect.equals("M1-bar", c.bar); | 40 Expect.equals("M1-bar", c.bar); |
41 Expect.equals("M1-bar", d.bar); | 41 Expect.equals("M1-bar", d.bar); |
42 Expect.equals("M1-bar", e.bar); | 42 Expect.equals("M1-bar", e.bar); |
43 Expect.equals("M1-bar", f.bar); | 43 Expect.equals("M1-bar", f.bar); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 Expect.throws(() => c.fez = 0, (error) => error is NoSuchMethodError); | 113 Expect.throws(() => c.fez = 0, (error) => error is NoSuchMethodError); |
114 Expect.throws(() => d.fez = 0, (error) => error is NoSuchMethodError); | 114 Expect.throws(() => d.fez = 0, (error) => error is NoSuchMethodError); |
115 Expect.throws(() => e.fez = 0, (error) => error is NoSuchMethodError); | 115 Expect.throws(() => e.fez = 0, (error) => error is NoSuchMethodError); |
116 | 116 |
117 f.fez = "F-fez-f"; | 117 f.fez = "F-fez-f"; |
118 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); | 118 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); |
119 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); | 119 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); |
120 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); | 120 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); |
121 Expect.equals("F-fez-f", f.fez); | 121 Expect.equals("F-fez-f", f.fez); |
122 } | 122 } |
OLD | NEW |