| OLD | NEW |
| 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 arrays from const array literals are immutable. | 4 // Check that arrays from const array literals are immutable. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | |
| 7 | |
| 8 class ListLiteral3Test { | 6 class ListLiteral3Test { |
| 9 | 7 |
| 10 static const List<String> canonicalJoke = const ["knock", "knock"]; | 8 static const List<String> canonicalJoke = const ["knock", "knock"]; |
| 11 | 9 |
| 12 static testMain() { | 10 static testMain() { |
| 13 | 11 |
| 14 List<String> joke = const ["knock", "knock"]; | 12 List<String> joke = const ["knock", "knock"]; |
| 15 // Elements of canonical lists are canonicalized. | 13 // Elements of canonical lists are canonicalized. |
| 16 Expect.identical(joke, canonicalJoke); | 14 Expect.identical(joke, canonicalJoke); |
| 17 Expect.identical(joke[0], joke[1]); | 15 Expect.identical(joke[0], joke[1]); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 40 Expect.identical(b[0], b[1]); | 38 Expect.identical(b[0], b[1]); |
| 41 Expect.equals(true, b[0][0] == 1.0); | 39 Expect.equals(true, b[0][0] == 1.0); |
| 42 Expect.identical(b[0][0], b[1][0]); | 40 Expect.identical(b[0][0], b[1][0]); |
| 43 Expect.throws(() { b[0][0] = 42.0; }, (e) => e is UnsupportedError); | 41 Expect.throws(() { b[0][0] = 42.0; }, (e) => e is UnsupportedError); |
| 44 } | 42 } |
| 45 } | 43 } |
| 46 | 44 |
| 47 main() { | 45 main() { |
| 48 ListLiteral3Test.testMain(); | 46 ListLiteral3Test.testMain(); |
| 49 } | 47 } |
| OLD | NEW |