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

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

Issue 2994383002: Migrating block 50, first commit, after tool has run (Closed)
Patch Set: formatting Created 3 years, 4 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
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "package:expect/expect.dart";
6
7 class A {
8 final x;
9 final y;
10 final z;
11 final t;
12
13 const A([this.z = 99, tt = 100])
14 : y = 499,
15 t = tt,
16 x = 3;
17 const A.n({this.z: 99, tt: 100})
18 : y = 499,
19 t = tt,
20 x = 3;
21 const A.named({z, this.t})
22 : y = 400 + z,
23 this.z = z,
24 x = 3;
25 const A.named2({t, z, y, x})
26 : x = t,
27 y = z,
28 z = y,
29 t = x;
30
31 toString() => "A $x $y $z $t";
32 }
33
34 const a1 = const A(99, 100);
35 const a2 = const A.named(z: 99, t: 100);
36 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4);
37 const a4 = const A();
38 const a5 = const A(99, 100);
39 const a5n = const A.n(tt: 100, z: 99);
40 const a6 = const A(1, 2);
41 const a6n = const A.n(z: 1, tt: 2);
42 const a7 = const A.named(z: 7);
43 const a8 = const A.named2();
44 const a9 = const A.named2(x: 4, y: 3, z: 2, t: 1);
45 const a10 = const A.named2(x: 1, y: 2, z: 3, t: 4);
46
47 main() {
48 Expect.equals(3, a1.x);
49 Expect.equals(499, a1.y);
50 Expect.equals(99, a1.z);
51 Expect.equals(100, a1.t);
52 Expect.equals("A 3 499 99 100", a1.toString());
53 Expect.isTrue(identical(a1, a2));
54 Expect.isTrue(identical(a1, a4));
55 Expect.isTrue(identical(a1, a5));
56
57 Expect.equals(1, a3.x);
58 Expect.equals(2, a3.y);
59 Expect.equals(3, a3.z);
60 Expect.equals(4, a3.t);
61 Expect.equals("A 1 2 3 4", a3.toString());
62
63 Expect.equals(3, a6.x);
64 Expect.equals(499, a6.y);
65 Expect.equals(1, a6.z);
66 Expect.equals(2, a6.t);
67 Expect.equals("A 3 499 1 2", a6.toString());
68
69 Expect.equals(3, a7.x);
70 Expect.equals(407, a7.y);
71 Expect.equals(7, a7.z);
72 Expect.equals(null, a7.t);
73 Expect.equals("A 3 407 7 null", a7.toString());
74
75 Expect.equals(null, a8.x);
76 Expect.equals(null, a8.y);
77 Expect.equals(null, a8.y);
78 Expect.equals(null, a8.t);
79 Expect.equals("A null null null null", a8.toString());
80
81 Expect.isTrue(identical(a3, a9));
82
83 Expect.equals(4, a10.x);
84 Expect.equals(3, a10.y);
85 Expect.equals(2, a10.z);
86 Expect.equals(1, a10.t);
87 Expect.equals("A 4 3 2 1", a10.toString());
88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698