Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 class S { | |
| 6 var foo = "S-foo"; | |
| 7 } | |
| 8 | |
| 9 class M1 { | |
| 10 final bar = "M1-bar"; | |
| 11 } | |
| 12 | |
| 13 class M2 { | |
| 14 var baz = "M2-baz"; | |
| 15 } | |
| 16 | |
| 17 typedef C = S with M1; | |
| 18 typedef D = S with M1, M2; | |
| 19 typedef E = S with M2, M1; | |
| 20 | |
| 21 class F extends E { | |
| 22 var fez = "F-fez"; | |
| 23 } | |
| 24 | |
| 25 main() { | |
| 26 var c = new C(); | |
| 27 var d = new D(); | |
| 28 var e = new E(); | |
| 29 var f = new F(); | |
| 30 | |
| 31 Expect.equals("S-foo", c.foo); | |
| 32 Expect.equals("S-foo", d.foo); | |
| 33 Expect.equals("S-foo", e.foo); | |
| 34 Expect.equals("S-foo", f.foo); | |
| 35 | |
| 36 Expect.equals("M1-bar", c.bar); | |
| 37 Expect.equals("M1-bar", d.bar); | |
| 38 Expect.equals("M1-bar", e.bar); | |
| 39 Expect.equals("M1-bar", f.bar); | |
| 40 | |
| 41 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); | |
|
ahe
2013/01/18 12:40:12
You could create a help function for: (error) => e
| |
| 42 Expect.equals("M2-baz", d.baz); | |
| 43 Expect.equals("M2-baz", e.baz); | |
| 44 Expect.equals("M2-baz", f.baz); | |
| 45 | |
| 46 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); | |
| 47 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); | |
| 48 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); | |
| 49 Expect.equals("F-fez", f.fez); | |
| 50 | |
| 51 c.foo = "S-foo-c"; | |
| 52 Expect.equals("S-foo-c", c.foo); | |
| 53 Expect.equals("S-foo", d.foo); | |
| 54 Expect.equals("S-foo", e.foo); | |
| 55 Expect.equals("S-foo", f.foo); | |
| 56 | |
| 57 d.foo = "S-foo-d"; | |
| 58 Expect.equals("S-foo-c", c.foo); | |
| 59 Expect.equals("S-foo-d", d.foo); | |
| 60 Expect.equals("S-foo", e.foo); | |
| 61 Expect.equals("S-foo", f.foo); | |
| 62 | |
| 63 e.foo = "S-foo-e"; | |
| 64 Expect.equals("S-foo-c", c.foo); | |
| 65 Expect.equals("S-foo-d", d.foo); | |
| 66 Expect.equals("S-foo-e", e.foo); | |
| 67 Expect.equals("S-foo", f.foo); | |
| 68 | |
| 69 f.foo = "S-foo-f"; | |
| 70 Expect.equals("S-foo-c", c.foo); | |
| 71 Expect.equals("S-foo-d", d.foo); | |
| 72 Expect.equals("S-foo-e", e.foo); | |
| 73 Expect.equals("S-foo-f", f.foo); | |
| 74 | |
| 75 Expect.throws(() => c.bar = 0, (error) => error is NoSuchMethodError); | |
| 76 Expect.throws(() => d.bar = 0, (error) => error is NoSuchMethodError); | |
| 77 Expect.throws(() => e.bar = 0, (error) => error is NoSuchMethodError); | |
| 78 Expect.throws(() => f.bar = 0, (error) => error is NoSuchMethodError); | |
| 79 Expect.equals("M1-bar", c.bar); | |
| 80 Expect.equals("M1-bar", d.bar); | |
| 81 Expect.equals("M1-bar", e.bar); | |
| 82 Expect.equals("M1-bar", f.bar); | |
| 83 | |
| 84 Expect.throws(() => c.baz = 0, (error) => error is NoSuchMethodError); | |
| 85 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); | |
| 86 Expect.equals("M2-baz", d.baz); | |
| 87 Expect.equals("M2-baz", e.baz); | |
| 88 Expect.equals("M2-baz", f.baz); | |
| 89 | |
| 90 d.baz = "M2-baz-d"; | |
| 91 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); | |
| 92 Expect.equals("M2-baz-d", d.baz); | |
| 93 Expect.equals("M2-baz", e.baz); | |
| 94 Expect.equals("M2-baz", f.baz); | |
| 95 Expect.equals("M2-baz", f.baz); | |
| 96 | |
| 97 e.baz = "M2-baz-e"; | |
| 98 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); | |
| 99 Expect.equals("M2-baz-d", d.baz); | |
| 100 Expect.equals("M2-baz-e", e.baz); | |
| 101 Expect.equals("M2-baz", f.baz); | |
| 102 | |
| 103 f.baz = "M2-baz-f"; | |
| 104 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); | |
| 105 Expect.equals("M2-baz-d", d.baz); | |
| 106 Expect.equals("M2-baz-e", e.baz); | |
| 107 Expect.equals("M2-baz-f", f.baz); | |
| 108 | |
| 109 Expect.throws(() => c.fez = 0, (error) => error is NoSuchMethodError); | |
| 110 Expect.throws(() => d.fez = 0, (error) => error is NoSuchMethodError); | |
| 111 Expect.throws(() => e.fez = 0, (error) => error is NoSuchMethodError); | |
| 112 | |
| 113 f.fez = "F-fez-f"; | |
| 114 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); | |
| 115 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); | |
| 116 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); | |
| 117 Expect.equals("F-fez-f", f.fez); | |
| 118 } | |
| OLD | NEW |