OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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"; |
| 6 |
5 class A { | 7 class A { |
6 A() { | 8 A() { |
7 } | 9 } |
8 int x; | 10 int x; |
9 | 11 |
10 foo() { | 12 foo() { |
11 x = 42; | 13 x = 42; |
12 Expect.equals(42, x); | 14 Expect.equals(42, x); |
13 x = 0; | 15 x = 0; |
14 Expect.equals(0, x); | 16 Expect.equals(0, x); |
15 } | 17 } |
16 } | 18 } |
17 | 19 |
18 class B extends A { | 20 class B extends A { |
19 } | 21 } |
20 | 22 |
21 main() { | 23 main() { |
22 A a = new A(); | 24 A a = new A(); |
23 a.foo(); | 25 a.foo(); |
24 Expect.equals(0, a.x); | 26 Expect.equals(0, a.x); |
25 a.x = 4; | 27 a.x = 4; |
26 Expect.equals(4, a.x); | 28 Expect.equals(4, a.x); |
27 a.x += 1; | 29 a.x += 1; |
28 Expect.equals(5, a.x); | 30 Expect.equals(5, a.x); |
29 | 31 |
30 B b = new B(); | 32 B b = new B(); |
31 b.foo(); | 33 b.foo(); |
32 Expect.equals(0, b.x); | 34 Expect.equals(0, b.x); |
33 } | 35 } |
OLD | NEW |