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