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"; |
| 6 |
5 class A { | 7 class A { |
6 var _x, _y; | 8 var _x, _y; |
7 A(x, [y = 10]): _x = x++, _y = y++ { | 9 A(x, [y = 10]): _x = x++, _y = y++ { |
8 // Check that value of modified constructor parameters | 10 // Check that value of modified constructor parameters |
9 // is remembered in the constructor body. | 11 // is remembered in the constructor body. |
10 Expect.equals(x, _x + 1); | 12 Expect.equals(x, _x + 1); |
11 Expect.equals(y, _y + 1); | 13 Expect.equals(y, _y + 1); |
12 Expect.isFalse(?y); | 14 Expect.isFalse(?y); |
13 } | 15 } |
14 } | 16 } |
(...skipping 13 matching lines...) Expand all Loading... |
28 main() { | 30 main() { |
29 var o = new B(3, 5); | 31 var o = new B(3, 5); |
30 Expect.equals(3, o._a); | 32 Expect.equals(3, o._a); |
31 Expect.equals(6, o._b); | 33 Expect.equals(6, o._b); |
32 Expect.equals(9, o._x); | 34 Expect.equals(9, o._x); |
33 Expect.equals(10, o._y); | 35 Expect.equals(10, o._y); |
34 o = new A(3); | 36 o = new A(3); |
35 Expect.equals(3, o._x); | 37 Expect.equals(3, o._x); |
36 Expect.equals(10, o._y); | 38 Expect.equals(10, o._y); |
37 } | 39 } |
OLD | NEW |