Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: tests/language/constructor_initializer_test.dart

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"; 5 import "package:expect/expect.dart";
6 6
7 class A { 7 class A {
8 var _x, _y; 8 var _x, _y;
9 A(x, [y = 10]) 9 A(x, [y = 10]): _x = x++, _y = y++ {
10 : _x = x++,
11 _y = y++ {
12 // Check that value of modified constructor parameters 10 // Check that value of modified constructor parameters
13 // is remembered in the constructor body. 11 // is remembered in the constructor body.
14 Expect.equals(x, _x + 1); 12 Expect.equals(x, _x + 1);
15 Expect.equals(y, _y + 1); 13 Expect.equals(y, _y + 1);
16 Expect.isFalse(?y); // //# 01: compile-time error 14 Expect.isFalse(?y); // //# 01: compile-time error
17 } 15 }
18 } 16 }
19 17
20 class B extends A { 18 class B extends A {
21 var _a, _b; 19 var _a, _b;
22 // The super call in the middle of the initializer list conceptually 20 // The super call in the middle of the initializer list conceptually
23 // forces two super call chains, one for initializer list and a second 21 // forces two super call chains, one for initializer list and a second
24 // one for the constructor bodies. 22 // one for the constructor bodies.
25 B(a, b) 23 B(a, b): _a = a++, super(a + b++), _b = b++ {
26 : _a = a++,
27 super(a + b++),
28 _b = b++ {
29 Expect.equals(a, _a + 1); 24 Expect.equals(a, _a + 1);
30 Expect.equals(b, _b + 1); 25 Expect.equals(b, _b + 1);
31 Expect.equals(a + (b - 2), _x); 26 Expect.equals(a + (b-2), _x);
32 } 27 }
33 } 28 }
34 29
35 main() { 30 main() {
36 var o = new B(3, 5); 31 var o = new B(3, 5);
37 Expect.equals(3, o._a); 32 Expect.equals(3, o._a);
38 Expect.equals(6, o._b); 33 Expect.equals(6, o._b);
39 Expect.equals(9, o._x); 34 Expect.equals(9, o._x);
40 Expect.equals(10, o._y); 35 Expect.equals(10, o._y);
41 o = new A(3); 36 o = new A(3);
42 Expect.equals(3, o._x); 37 Expect.equals(3, o._x);
43 Expect.equals(10, o._y); 38 Expect.equals(10, o._y);
44 } 39 }
OLDNEW
« no previous file with comments | « tests/language/constructor_duplicate_initializers_test.dart ('k') | tests/language/constructor_name_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698