| 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 // Test program for map literals. | 4 // Test program for map literals. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | |
| 7 | |
| 8 class MapLiteralTest { | 6 class MapLiteralTest { |
| 9 | 7 |
| 10 static testMain() { | 8 static testMain() { |
| 11 var map = { "a": 1, "b": 2, "c": 3 }; | 9 var map = { "a": 1, "b": 2, "c": 3 }; |
| 12 | 10 |
| 13 Expect.equals(map.length, 3); | 11 Expect.equals(map.length, 3); |
| 14 Expect.equals(map["a"], 1); | 12 Expect.equals(map["a"], 1); |
| 15 Expect.equals(map["z"], null); | 13 Expect.equals(map["z"], null); |
| 16 Expect.equals(map["c"], 3); | 14 Expect.equals(map["c"], 3); |
| 17 | 15 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Map literals at beginning of statement. | 95 // Map literals at beginning of statement. |
| 98 <String, num>{"pink": 100}; | 96 <String, num>{"pink": 100}; |
| 99 const <String, num>{"floyd": 100}; | 97 const <String, num>{"floyd": 100}; |
| 100 } | 98 } |
| 101 } | 99 } |
| 102 | 100 |
| 103 | 101 |
| 104 main() { | 102 main() { |
| 105 MapLiteralTest.testMain(); | 103 MapLiteralTest.testMain(); |
| 106 } | 104 } |
| OLD | NEW |