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

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

Issue 348053002: dart2dart: Support for all constants in new backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: SVN rebase + merge Created 6 years, 6 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_global_test.dart ('k') | tests/language/const_local_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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 class ConstListTest { 7 class ConstListTest {
8 8
9 static testMain() { 9 static testConstructors() {
10 List fixedList = new List(4); 10 List fixedList = new List(4);
11 List fixedList2 = new List(4); 11 List fixedList2 = new List(4);
12 List growableList = new List(); 12 List growableList = new List();
13 List growableList2 = new List(); 13 List growableList2 = new List();
14 for (int i = 0; i < 4; i++) { 14 for (int i = 0; i < 4; i++) {
15 fixedList[i] = i; 15 fixedList[i] = i;
16 fixedList2[i] = i; 16 fixedList2[i] = i;
17 growableList.add(i); 17 growableList.add(i);
18 growableList2.add(i); 18 growableList2.add(i);
19 } 19 }
20 Expect.equals(true, growableList == growableList); 20 Expect.equals(true, growableList == growableList);
21 Expect.equals(false, growableList == growableList2); 21 Expect.equals(false, growableList == growableList2);
22 Expect.equals(true, fixedList == fixedList); 22 Expect.equals(true, fixedList == fixedList);
23 Expect.equals(false, fixedList == fixedList2); 23 Expect.equals(false, fixedList == fixedList2);
24 Expect.equals(false, fixedList == growableList); 24 Expect.equals(false, fixedList == growableList);
25 growableList.add(4); 25 growableList.add(4);
26 Expect.equals(false, fixedList == growableList); 26 Expect.equals(false, fixedList == growableList);
27 Expect.equals(4, growableList.removeLast()); 27 Expect.equals(4, growableList.removeLast());
28 Expect.equals(false, fixedList == growableList); 28 Expect.equals(false, fixedList == growableList);
29 fixedList[3] = 0; 29 fixedList[3] = 0;
30 Expect.equals(false, fixedList == growableList); 30 Expect.equals(false, fixedList == growableList);
31 }
32
33 static testLiterals() {
31 var a = [1, 2, 3.1]; 34 var a = [1, 2, 3.1];
32 var b = [1, 2, 3.1]; 35 var b = [1, 2, 3.1];
33 Expect.equals(false, a == b); 36 Expect.equals(false, a == b);
34 a = const [1, 2, 3.1]; 37 a = const [1, 2, 3.1];
35 b = const [1, 2, 3.1]; 38 b = const [1, 2, 3.1];
36 Expect.equals(true, a == b); 39 Expect.equals(true, a == b);
37 a = const <num>[1, 2, 3.1]; 40 a = const <num>[1, 2, 3.1];
38 b = const [1, 2, 3.1]; 41 b = const [1, 2, 3.1];
39 Expect.equals(false, a == b); 42 Expect.equals(false, a == b);
40 a = const <dynamic>[1, 2, 3.1]; 43 a = const <dynamic>[1, 2, 3.1];
41 b = const [1, 2, 3.1]; 44 b = const [1, 2, 3.1];
42 Expect.equals(true, a == b); 45 Expect.equals(true, a == b);
43 } 46 }
44 } 47 }
45 48
46 main() { 49 main() {
47 ConstListTest.testMain(); 50 ConstListTest.testConstructors();
51 ConstListTest.testLiterals();
48 } 52 }
OLDNEW
« no previous file with comments | « tests/language/const_global_test.dart ('k') | tests/language/const_local_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698