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

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

Issue 10871071: - Change "static final" to "static const" in the tests/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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
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 // Dart test program for testing static final fields. 4 // Dart test program for testing static const fields.
5 5
6 interface Spain { 6 abstract class Spain {
7 static final AG = "Antoni Gaudi"; 7 static const AG = "Antoni Gaudi";
8 static final SD = "Salvador Dali"; 8 static const SD = "Salvador Dali";
9 } 9 }
10 10
11 interface Switzerland { 11 abstract class Switzerland {
12 static final AG = "Alberto Giacometti"; 12 static const AG = "Alberto Giacometti";
13 static final LC = "Le Corbusier"; 13 static const LC = "Le Corbusier";
14 } 14 }
15 15
16 class A implements Switzerland { 16 class A implements Switzerland {
17 const A() : n = 5; 17 const A() : n = 5;
18 final n; 18 final n;
19 static final a = const A(); 19 static const a = const A();
20 static final b = 3 + 5; 20 static const b = 3 + 5;
21 static final c = A.b + 7; 21 static const c = A.b + 7;
22 static final d = const A(); 22 static const d = const A();
23 static final s1 = "hula"; 23 static const s1 = "hula";
24 static final s2 = "hula"; 24 static const s2 = "hula";
25 static final s3 = "hop"; 25 static const s3 = "hop";
26 static final d1 = 1.1; 26 static const d1 = 1.1;
27 static final d2 = 0.55 + 0.55; 27 static const d2 = 0.55 + 0.55;
28 static final artist2 = Switzerland.AG; 28 static const artist2 = Switzerland.AG;
29 static final architect1 = Spain.AG; 29 static const architect1 = Spain.AG;
30 static final array1 = const <int>[1, 2]; 30 static const array1 = const <int>[1, 2];
31 static final map1 = const {"Monday": 1, "Tuesday": 2, }; 31 static const map1 = const {"Monday": 1, "Tuesday": 2, };
32 } 32 }
33 33
34 class StaticFinalFieldTest { 34 class StaticFinalFieldTest {
35 static testMain() { 35 static testMain() {
36 Expect.equals(15, A.c); 36 Expect.equals(15, A.c);
37 Expect.equals(8, A.b); 37 Expect.equals(8, A.b);
38 Expect.equals(5, A.a.n); 38 Expect.equals(5, A.a.n);
39 Expect.equals(true, 8 === A.b); 39 Expect.equals(true, 8 === A.b);
40 Expect.equals(true, A.a === A.d); 40 Expect.equals(true, A.a === A.d);
41 Expect.equals(true, A.s1 === A.s2); 41 Expect.equals(true, A.s1 === A.s2);
42 Expect.equals(false, A.s1 === A.s3); 42 Expect.equals(false, A.s1 === A.s3);
43 Expect.equals(false, A.s1 === A.b); 43 Expect.equals(false, A.s1 === A.b);
44 Expect.equals(true, A.d1 === A.d2); 44 Expect.equals(true, A.d1 === A.d2);
45 Expect.equals(true, Spain.SD == "Salvador Dali"); 45 Expect.equals(true, Spain.SD == "Salvador Dali");
46 Expect.equals(true, A.artist2 == "Alberto Giacometti"); 46 Expect.equals(true, A.artist2 == "Alberto Giacometti");
47 Expect.equals(true, A.architect1 == "Antoni Gaudi"); 47 Expect.equals(true, A.architect1 == "Antoni Gaudi");
48 Expect.equals(2, A.map1["Tuesday"]); 48 Expect.equals(2, A.map1["Tuesday"]);
49 } 49 }
50 } 50 }
51 51
52 main() { 52 main() {
53 StaticFinalFieldTest.testMain(); 53 StaticFinalFieldTest.testMain();
54 } 54 }
OLDNEW
« no previous file with comments | « tests/language/map_literal_test.dart ('k') | tests/language/static_final_field2_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698