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

Side by Side Diff: tests/language/src/CanonicalConstTest.dart

Issue 8676001: Implement type checking of list literals (issue 220). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/language.status ('k') | tests/language/src/ListLiteral1NegativeTest.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 // Check that initializers of static const fields are compile time constants. 4 // Check that initializers of static const fields are compile time constants.
5 5
6 class CanonicalConstTest { 6 class CanonicalConstTest {
7 static final A = const C1(); 7 static final A = const C1();
8 static final B = const C2(); 8 static final B = const C2();
9 9
10 static testMain() { 10 static testMain() {
11 Expect.isTrue(null===null); 11 Expect.isTrue(null===null);
12 Expect.isTrue(null!==0); 12 Expect.isTrue(null!==0);
13 Expect.isTrue(1===1); 13 Expect.isTrue(1===1);
14 Expect.isTrue(1!==2); 14 Expect.isTrue(1!==2);
15 Expect.isTrue(true===true); 15 Expect.isTrue(true===true);
16 Expect.isTrue("so"==="so"); 16 Expect.isTrue("so"==="so");
17 Expect.isTrue(const Object()===const Object()); 17 Expect.isTrue(const Object()===const Object());
18 Expect.isTrue(const Object()!==const C1()); 18 Expect.isTrue(const Object()!==const C1());
19 Expect.isTrue(const C1()===const C1()); 19 Expect.isTrue(const C1()===const C1());
20 Expect.isTrue(A===const C1()); 20 Expect.isTrue(A===const C1());
21 Expect.isTrue(const C1()!==const C2()); 21 Expect.isTrue(const C1()!==const C2());
22 Expect.isTrue(B===const C2()); 22 Expect.isTrue(B===const C2());
23 // TODO(johnlenz): these two values don't currently have the same type 23 // TODO(johnlenz): these two values don't currently have the same type
24 // Expect.isTrue(const [1,2] === const List[1,2]); 24 // Expect.isTrue(const [1,2] === const List[1,2]);
25 Expect.isTrue(const [2,1] !== const[1,2]); 25 Expect.isTrue(const [2,1] !== const[1,2]);
26 Expect.isTrue(const <int>[1,2] === const <int>[1,2]); 26 Expect.isTrue(const <int>[1,2] === const <int>[1,2]);
27 Expect.isTrue(const <Object>[1,2] === const <Object>[1,2]); 27 Expect.isTrue(const <Object>[1,2] === const <Object>[1,2]);
28 Expect.isTrue(const <int>[1,2] !== const <double>[1,2]); 28 Expect.isTrue(const <int>[1,2] !== const <double>[1.0,2.0]);
29 Expect.isTrue(const {"a":1, "b":2} === const {"a":1, "b":2}); 29 Expect.isTrue(const {"a":1, "b":2} === const {"a":1, "b":2});
30 Expect.isTrue(const {"a":1, "b":2} !== const {"a":2, "b":2}); 30 Expect.isTrue(const {"a":1, "b":2} !== const {"a":2, "b":2});
31 } 31 }
32 } 32 }
33 33
34 class C1 { 34 class C1 {
35 const C1(); 35 const C1();
36 } 36 }
37 37
38 class C2 extends C1 { 38 class C2 extends C1 {
39 const C2() : super(); 39 const C2() : super();
40 } 40 }
41 41
42 main() { 42 main() {
43 CanonicalConstTest.testMain(); 43 CanonicalConstTest.testMain();
44 } 44 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | tests/language/src/ListLiteral1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698