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

Side by Side Diff: tests/language_strong/compile_time_constant10_test.dart

Issue 2774783002: Re-land "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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 // Test that 'identical(a,b)' is a compile-time constant. 7 // Test that 'identical(a,b)' is a compile-time constant.
8 8
9 class C { 9 class C {
10 final x; 10 final x;
11 const C(this.x); 11 const C(this.x);
12 static f3(){} 12 static f3() {}
13 static f4(){} 13 static f4() {}
14 } 14 }
15 15
16 const i1 = 1; 16 const i1 = 1;
17 const i2 = 2; 17 const i2 = 2;
18 const d1 = 1.5; 18 const d1 = 1.5;
19 const d2 = 2.5; 19 const d2 = 2.5;
20 const b1 = true; 20 const b1 = true;
21 const b2 = false; 21 const b2 = false;
22 const s1 = "1"; 22 const s1 = "1";
23 const s2 = "2"; 23 const s2 = "2";
24 const l1 = const [1,2]; 24 const l1 = const [1, 2];
25 const l2 = const [2,3]; 25 const l2 = const [2, 3];
26 const m1 = const {"x": 1}; 26 const m1 = const {"x": 1};
27 const m2 = const {"x": 2}; 27 const m2 = const {"x": 2};
28 const c1 = const C(1); 28 const c1 = const C(1);
29 const c2 = const C(2); 29 const c2 = const C(2);
30 f1(){} 30 f1() {}
31 f2(){} 31 f2() {}
32 const id = identical; 32 const id = identical;
33 33
34 class CT { 34 class CT {
35 final x1; 35 final x1;
36 final x2; 36 final x2;
37 final bool id; 37 final bool id;
38 const CT(var x1, var x2) 38 const CT(var x1, var x2)
39 : this.x1 = x1, this.x2 = x2, this.id = identical(x1, x2); 39 : this.x1 = x1,
40 void test(void expect(a,b), name) { 40 this.x2 = x2,
41 this.id = identical(x1, x2);
42 void test(void expect(a, b), name) {
41 expect(id, "$name: identical($x1,$x2)"); 43 expect(id, "$name: identical($x1,$x2)");
42 } 44 }
43 } 45 }
44 46
45 const trueTests = const [ 47 const trueTests = const [
46 const CT(2 - 1, i1), 48 const CT(2 - 1, i1),
47 const CT(1 + 1, i2), 49 const CT(1 + 1, i2),
48 const CT(2.5 - 1.0, d1), 50 const CT(2.5 - 1.0, d1),
49 const CT(1.5 + 1.0, d2), 51 const CT(1.5 + 1.0, d2),
50 const CT(false || true, b1), 52 const CT(false || true, b1),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 for (int i = 0; i < trueTests.length; i++) { 101 for (int i = 0; i < trueTests.length; i++) {
100 trueTests[i].test(Expect.isTrue, "true[$i]"); 102 trueTests[i].test(Expect.isTrue, "true[$i]");
101 } 103 }
102 for (int i = 0; i < falseTests.length; i++) { 104 for (int i = 0; i < falseTests.length; i++) {
103 falseTests[i].test(Expect.isFalse, "false[$i]"); 105 falseTests[i].test(Expect.isFalse, "false[$i]");
104 } 106 }
105 107
106 var x = idtest; // //# 01: continued 108 var x = idtest; // //# 01: continued
107 var x = T.idtest2; // //# 02: continued 109 var x = T.idtest2; // //# 02: continued
108 } 110 }
109
OLDNEW
« no previous file with comments | « tests/language_strong/closure_type_test.dart ('k') | tests/language_strong/compile_time_constant13_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698