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

Side by Side Diff: tests/language/src/CompileTimeConstantETest.dart

Issue 9703105: Re-land r5529. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/language-leg.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class A {
6 final x = 3;
7 final y;
8 final z;
9 final t;
10
11 const A([this.z = 99, tt = 100]) : y = 499, t = tt;
12 const A.named([z, this.t]) : y = 400 + z, this.z = z;
13 const A.named2([t, z, y, x]) : x = t, y = z, z = y, t = x;
14
15 toString() => "A $x $y $z $t";
16 }
17
18 final a1 = const A(99, 100);
19 final a2 = const A.named(99, 100);
20 final a3 = const A.named2(1, 2, 3, 4);
21 final a4 = const A();
22 final a5 = const A(tt: 100, z: 99);
23 final a6 = const A(1, tt: 2);
24 final a7 = const A.named(z: 7);
25 final a8 = const A.named2();
26 final a9 = const A.named2(x: 4, y: 3, z: 2, t: 1);
27 final a10 = const A.named2(x: 1, y: 2, z: 3, t: 4);
28
29 main() {
30 Expect.equals(3, a1.x);
31 Expect.equals(499, a1.y);
32 Expect.equals(99, a1.z);
33 Expect.equals(100, a1.t);
34 Expect.equals("A 3 499 99 100", a1.toString());
35 Expect.isTrue(a1 === a2);
36 Expect.isTrue(a1 === a4);
37 Expect.isTrue(a1 === a5);
38
39 Expect.equals(1, a3.x);
40 Expect.equals(2, a3.y);
41 Expect.equals(3, a3.z);
42 Expect.equals(4, a3.t);
43 Expect.equals("A 1 2 3 4", a3.toString());
44
45 Expect.equals(3, a6.x);
46 Expect.equals(499, a6.y);
47 Expect.equals(1, a6.z);
48 Expect.equals(2, a6.t);
49 Expect.equals("A 3 499 1 2", a6.toString());
50
51 Expect.equals(3, a7.x);
52 Expect.equals(407, a7.y);
53 Expect.equals(7, a7.z);
54 Expect.equals(null, a7.t);
55 Expect.equals("A 3 407 7 null", a7.toString());
56
57 Expect.equals(null, a8.x);
58 Expect.equals(null, a8.y);
59 Expect.equals(null, a8.y);
60 Expect.equals(null, a8.t);
61 Expect.equals("A null null null null", a8.toString());
62
63 Expect.isTrue(a3 === a9);
64
65 Expect.equals(4, a10.x);
66 Expect.equals(3, a10.y);
67 Expect.equals(2, a10.z);
68 Expect.equals(1, a10.t);
69 Expect.equals("A 4 3 2 1", a10.toString());
70 }
OLDNEW
« no previous file with comments | « tests/language/language-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698