| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Test that 'identical(a,b)' is a compile-time constant. | 7 // Test that 'identical(a,b)' is a compile-time constant. |
| 8 | 8 |
| 9 class C { | 9 class C { |
| 10 final x; | 10 final x; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const m2 = const {"x": 2}; | 27 const m2 = const {"x": 2}; |
| 28 const c1 = const C(1); | 28 const c1 = const C(1); |
| 29 const c2 = const C(2); | 29 const c2 = const C(2); |
| 30 f1(){} | 30 f1(){} |
| 31 f2(){} | 31 f2(){} |
| 32 const id = identical; | 32 const id = identical; |
| 33 | 33 |
| 34 class CT { | 34 class CT { |
| 35 final x1; | 35 final x1; |
| 36 final x2; | 36 final x2; |
| 37 bool id; | 37 final bool id; |
| 38 const CT(var x1, var x2) | 38 const CT(var x1, var x2) |
| 39 : this.x1 = x1, this.x2 = x2, this.id = identical(x1, x2); | 39 : this.x1 = x1, this.x2 = x2, this.id = identical(x1, x2); |
| 40 void test(void expect(a,b), name) { | 40 void test(void expect(a,b), name) { |
| 41 expect(id, "$name: identical($x1,$x2)"); | 41 expect(id, "$name: identical($x1,$x2)"); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 const trueTests = const [ | 45 const trueTests = const [ |
| 46 const CT(2 - 1, i1), | 46 const CT(2 - 1, i1), |
| 47 const CT(1 + 1, i2), | 47 const CT(1 + 1, i2), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 trueTests[i].test(Expect.isTrue, "true[$i]"); | 100 trueTests[i].test(Expect.isTrue, "true[$i]"); |
| 101 } | 101 } |
| 102 for (int i = 0; i < falseTests.length; i++) { | 102 for (int i = 0; i < falseTests.length; i++) { |
| 103 falseTests[i].test(Expect.isFalse, "false[$i]"); | 103 falseTests[i].test(Expect.isFalse, "false[$i]"); |
| 104 } | 104 } |
| 105 | 105 |
| 106 var x = idtest; /// 01: continued | 106 var x = idtest; /// 01: continued |
| 107 var x = T.idtest2; /// 02: continued | 107 var x = T.idtest2; /// 02: continued |
| 108 } | 108 } |
| 109 | 109 |
| OLD | NEW |