| 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 void expectEquals(var expected, var actual) { | 5 void expectEquals(var expected, var actual) { |
| 6 if (expected == actual) { | 6 if (expected == actual) { |
| 7 } else { | 7 } else { |
| 8 print("Actual does not match expected"); | 8 print("Actual does not match expected"); |
| 9 throw actual; | 9 throw actual; |
| 10 } | 10 } |
| 11 } | 11 } |
| 12 | 12 |
| 13 class A { | 13 class A { |
| 14 static int b; | 14 static int b; |
| 15 | |
| 16 setA(val) { | |
| 17 b = val; | |
| 18 } | |
| 19 | |
| 20 bar() { | |
| 21 return b; | |
| 22 } | |
| 23 | |
| 24 bar2() { | |
| 25 return A.b; | |
| 26 } | |
| 27 } | 15 } |
| 28 | 16 |
| 29 main() { | 17 main() { |
| 30 A a = new A(); | 18 A.b = 42; |
| 31 a.setA(42); | 19 expectEquals(42, A.b); |
| 32 expectEquals(42, a.bar()); | |
| 33 expectEquals(42, a.bar2()); | |
| 34 } | 20 } |
| OLD | NEW |