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

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

Issue 10837359: Language tests updated to use const instead of final. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/const_init_test.dart ('k') | tests/language/ct_const3_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // VMOptions= 4 // VMOptions=
5 // VMOptions=--compile_all 5 // VMOptions=--compile_all
6 6
7 // Exercises language constructs that require compile time constants 7 // Exercises language constructs that require compile time constants
8 8
9 // Initialize with different literal types 9 // Initialize with different literal types
10 final b = true; 10 const b = true;
11 final s = "apple"; 11 const s = "apple";
12 final i = 1; 12 const i = 1;
13 final d = 3.3; 13 const d = 3.3;
14 final h = 0xf; 14 const h = 0xf;
15 final n = null; 15 const n = null;
16 final aList = const[1, 2, 3]; // array literal 16 const aList = const[1, 2, 3]; // array literal
17 final aMap = const { "1": "one", "2": "banana" }; // map literal 17 const aMap = const { "1": "one", "2": "banana" }; // map literal
18 18
19 final INT_LIT = 5; 19 const INT_LIT = 5;
20 final INT_LIT_REF = INT_LIT; 20 const INT_LIT_REF = INT_LIT;
21 final DOUBLE_LIT = 1.5; 21 const DOUBLE_LIT = 1.5;
22 final BOOL_LIT = true; 22 const BOOL_LIT = true;
23 final STRING_LIT = "Hello"; 23 const STRING_LIT = "Hello";
24 24
25 final BOP1_0 = INT_LIT + 1; 25 const BOP1_0 = INT_LIT + 1;
26 final BOP1_1 = 1 + INT_LIT; 26 const BOP1_1 = 1 + INT_LIT;
27 final BOP1_2 = INT_LIT - 1; 27 const BOP1_2 = INT_LIT - 1;
28 final BOP1_3 = 1 - INT_LIT; 28 const BOP1_3 = 1 - INT_LIT;
29 final BOP1_4 = INT_LIT * 1; 29 const BOP1_4 = INT_LIT * 1;
30 final BOP1_5 = 1 * INT_LIT; 30 const BOP1_5 = 1 * INT_LIT;
31 final BOP1_6 = INT_LIT / 1; 31 const BOP1_6 = INT_LIT / 1;
32 final BOP1_7 = 1 / INT_LIT; 32 const BOP1_7 = 1 / INT_LIT;
33 final BOP2_0 = DOUBLE_LIT + 1.5; 33 const BOP2_0 = DOUBLE_LIT + 1.5;
34 final BOP2_1 = 1.5 + DOUBLE_LIT; 34 const BOP2_1 = 1.5 + DOUBLE_LIT;
35 final BOP2_2 = DOUBLE_LIT - 1.5; 35 const BOP2_2 = DOUBLE_LIT - 1.5;
36 final BOP2_3 = 1.5 - DOUBLE_LIT; 36 const BOP2_3 = 1.5 - DOUBLE_LIT;
37 final BOP2_4 = DOUBLE_LIT * 1.5; 37 const BOP2_4 = DOUBLE_LIT * 1.5;
38 final BOP2_5 = 1.5 * DOUBLE_LIT; 38 const BOP2_5 = 1.5 * DOUBLE_LIT;
39 final BOP2_6 = DOUBLE_LIT / 1.5; 39 const BOP2_6 = DOUBLE_LIT / 1.5;
40 final BOP2_7 = 1.5 / DOUBLE_LIT; 40 const BOP2_7 = 1.5 / DOUBLE_LIT;
41 final BOP3_0 = 2 < INT_LIT; 41 const BOP3_0 = 2 < INT_LIT;
42 final BOP3_1 = INT_LIT < 2; 42 const BOP3_1 = INT_LIT < 2;
43 final BOP3_2 = 2 > INT_LIT; 43 const BOP3_2 = 2 > INT_LIT;
44 final BOP3_3 = INT_LIT > 2; 44 const BOP3_3 = INT_LIT > 2;
45 final BOP3_4 = 2 < DOUBLE_LIT; 45 const BOP3_4 = 2 < DOUBLE_LIT;
46 final BOP3_5 = DOUBLE_LIT < 2; 46 const BOP3_5 = DOUBLE_LIT < 2;
47 final BOP3_6 = 2 > DOUBLE_LIT; 47 const BOP3_6 = 2 > DOUBLE_LIT;
48 final BOP3_7 = DOUBLE_LIT > 2; 48 const BOP3_7 = DOUBLE_LIT > 2;
49 final BOP3_8 = 2 <= INT_LIT; 49 const BOP3_8 = 2 <= INT_LIT;
50 final BOP3_9 = INT_LIT <= 2; 50 const BOP3_9 = INT_LIT <= 2;
51 final BOP3_10 = 2 >= INT_LIT; 51 const BOP3_10 = 2 >= INT_LIT;
52 final BOP3_11 = INT_LIT >= 2; 52 const BOP3_11 = INT_LIT >= 2;
53 final BOP3_12 = 2.0 <= DOUBLE_LIT; 53 const BOP3_12 = 2.0 <= DOUBLE_LIT;
54 final BOP3_13 = DOUBLE_LIT <= 2.0; 54 const BOP3_13 = DOUBLE_LIT <= 2.0;
55 final BOP3_14 = 2.0 >= DOUBLE_LIT; 55 const BOP3_14 = 2.0 >= DOUBLE_LIT;
56 final BOP3_15 = DOUBLE_LIT >= 2; 56 const BOP3_15 = DOUBLE_LIT >= 2;
57 final BOP4_0 = 5 % INT_LIT; 57 const BOP4_0 = 5 % INT_LIT;
58 final BOP4_1 = INT_LIT % 5; 58 const BOP4_1 = INT_LIT % 5;
59 final BOP4_2 = 5.0 % DOUBLE_LIT; 59 const BOP4_2 = 5.0 % DOUBLE_LIT;
60 final BOP4_3 = DOUBLE_LIT % 5.0; 60 const BOP4_3 = DOUBLE_LIT % 5.0;
61 final BOP5_0 = 0x80 & 0x04; 61 const BOP5_0 = 0x80 & 0x04;
62 final BOP5_1 = 0x80 | 0x04; 62 const BOP5_1 = 0x80 | 0x04;
63 final BOP5_2 = 0x80 << 0x04; 63 const BOP5_2 = 0x80 << 0x04;
64 final BOP5_3 = 0x80 >> 0x04; 64 const BOP5_3 = 0x80 >> 0x04;
65 final BOP5_4 = 0x80 ~/ 0x04; 65 const BOP5_4 = 0x80 ~/ 0x04;
66 final BOP5_5 = 0x80 ^ 0x04; 66 const BOP5_5 = 0x80 ^ 0x04;
67 final BOP6 = BOOL_LIT && true; 67 const BOP6 = BOOL_LIT && true;
68 final BOP7 = false || BOOL_LIT; 68 const BOP7 = false || BOOL_LIT;
69 final BOP8 = STRING_LIT == "World!"; 69 const BOP8 = STRING_LIT == "World!";
70 final BOP9 = "Hello" != STRING_LIT; 70 const BOP9 = "Hello" != STRING_LIT;
71 final BOP10 = INT_LIT === INT_LIT_REF; 71 const BOP10 = INT_LIT === INT_LIT_REF;
72 final BOP11 = BOOL_LIT !== true; 72 const BOP11 = BOOL_LIT !== true;
73 73
74 // Multiple binary expressions 74 // Multiple binary expressions
75 final BOP20 = 1 * INT_LIT / 3 + INT_LIT + 9; 75 const BOP20 = 1 * INT_LIT / 3 + INT_LIT + 9;
76 76
77 // Parenthised expressions 77 // Parenthised expressions
78 final BOP30 = ( 1 > 2 ); 78 const BOP30 = ( 1 > 2 );
79 final BOP31 = (1 * 2) + 3; 79 const BOP31 = (1 * 2) + 3;
80 final BOP32= 3 + (1 * 2); 80 const BOP32= 3 + (1 * 2);
81 81
82 // Unary expressions 82 // Unary expressions
83 final UOP1_0 = !BOOL_LIT; 83 const UOP1_0 = !BOOL_LIT;
84 final UOP1_1 = BOOL_LIT || !true; 84 const UOP1_1 = BOOL_LIT || !true;
85 final UOP1_2 = !BOOL_LIT || true; 85 const UOP1_2 = !BOOL_LIT || true;
86 final UOP1_3 = !(BOOL_LIT && true); 86 const UOP1_3 = !(BOOL_LIT && true);
87 final UOP2_0 = ~0xf0; 87 const UOP2_0 = ~0xf0;
88 final UOP2_1 = ~INT_LIT; 88 const UOP2_1 = ~INT_LIT;
89 final UOP2_2 = ~INT_LIT & 123; 89 const UOP2_2 = ~INT_LIT & 123;
90 final UOP2_3 = ~(INT_LIT | 0xff); 90 const UOP2_3 = ~(INT_LIT | 0xff);
91 final UOP3_0 = -0xf0; 91 const UOP3_0 = -0xf0;
92 final UOP3_1 = -INT_LIT; 92 const UOP3_1 = -INT_LIT;
93 final UOP3_2 = -INT_LIT + 123; 93 const UOP3_2 = -INT_LIT + 123;
94 final UOP3_3 = -(INT_LIT * 0xff); 94 const UOP3_3 = -(INT_LIT * 0xff);
95 final UOP3_4 = -0xf0; 95 const UOP3_4 = -0xf0;
96 final UOP3_5 = -DOUBLE_LIT; 96 const UOP3_5 = -DOUBLE_LIT;
97 final UOP3_6 = -DOUBLE_LIT + 123; 97 const UOP3_6 = -DOUBLE_LIT + 123;
98 final UOP3_7 = -(DOUBLE_LIT * 0xff); 98 const UOP3_7 = -(DOUBLE_LIT * 0xff);
99 99
100 class A { 100 class A {
101 const A(); 101 const A();
102 static final a = const A(); // Assignment from Constant constructor OK 102 static const a = const A(); // Assignment from Constant constructor OK
103 } 103 }
104 104
105 main () { 105 main () {
106 } 106 }
OLDNEW
« no previous file with comments | « tests/language/const_init_test.dart ('k') | tests/language/ct_const3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698