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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Tests map literals. 7 // Tests map literals.
8 8
9 class MapLiteralTest { 9 class MapLiteralTest {
10 MapLiteralTest() {} 10 MapLiteralTest() {}
11 11
12 static testMain() { 12 static testMain() {
13 var test = new MapLiteralTest(); 13 var test = new MapLiteralTest();
14 test.testStaticInit(); 14 test.testStaticInit();
15 test.testConstInit(); 15 test.testConstInit();
16 } 16 }
17 17
18 testStaticInit() { 18 testStaticInit() {
19 var testClass = new StaticInit(); 19 var testClass = new StaticInit();
20 testClass.test(); 20 testClass.test();
21 } 21 }
22 22
23 testConstInit() { 23 testConstInit() {
24 var testClass = new ConstInit(); 24 var testClass = new ConstInit();
25 testClass.test(); 25 testClass.test();
26 } 26 }
27 27
28 testLocalInit() { 28 testLocalInit() {
29 // Test construction of static const map literals 29 // Test construction of static const map literals
30 var map1 = {"a":1, "b":2}; 30 var map1 = {"a": 1, "b": 2};
31 // Test construction of static const map literals, with numbers 31 // Test construction of static const map literals, with numbers
32 var map2 = {"1":1, "2":2}; 32 var map2 = {"1": 1, "2": 2};
33 33
34 Expect.equals(1, map1["a"]); 34 Expect.equals(1, map1["a"]);
35 Expect.equals(2, map1["b"]); 35 Expect.equals(2, map1["b"]);
36 36
37 Expect.equals(1, map2["1"]); 37 Expect.equals(1, map2["1"]);
38 Expect.equals(2, map2["2"]); 38 Expect.equals(2, map2["2"]);
39 } 39 }
40 } 40 }
41 41
42 class StaticInit { 42 class StaticInit {
43 StaticInit() {} 43 StaticInit() {}
44 44
45 // Test construction of static const map literals 45 // Test construction of static const map literals
46 static const map1 = const {"a":1, "b":2}; 46 static const map1 = const {"a": 1, "b": 2};
47 // Test construction of static const map literals, with numbers 47 // Test construction of static const map literals, with numbers
48 static const map2 = const {"1":1, "2":2}; 48 static const map2 = const {"1": 1, "2": 2};
49 49
50 test() { 50 test() {
51 Expect.equals(1, map1["a"]); 51 Expect.equals(1, map1["a"]);
52 Expect.equals(2, map1["b"]); 52 Expect.equals(2, map1["b"]);
53 53
54 Expect.equals(1, map2["1"]); 54 Expect.equals(1, map2["1"]);
55 Expect.equals(2, map2["2"]); 55 Expect.equals(2, map2["2"]);
56 } 56 }
57 } 57 }
58 58
59 class ConstInit { 59 class ConstInit {
60
61 final map1; 60 final map1;
62 final map2; 61 final map2;
63 62
64 ConstInit() : this.map1 = {"a":1, "b":2}, this.map2 = {"1":1, "2":2} { 63 ConstInit()
65 } 64 : this.map1 = {"a": 1, "b": 2},
65 this.map2 = {"1": 1, "2": 2} {}
66 66
67 test() { 67 test() {
68 Expect.equals(1, map1["a"]); 68 Expect.equals(1, map1["a"]);
69 Expect.equals(2, map1["b"]); 69 Expect.equals(2, map1["b"]);
70 70
71 Expect.equals(1, map2["1"]); 71 Expect.equals(1, map2["1"]);
72 Expect.equals(2, map2["2"]); 72 Expect.equals(2, map2["2"]);
73 } 73 }
74 } 74 }
75 75
76 main() { 76 main() {
77 MapLiteralTest.testMain(); 77 MapLiteralTest.testMain();
78 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698