| 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 /** | 5 /** |
| 6 * Provide a trivial test for identity based hashed collections, which we | 6 * Provide a trivial test for identity based hashed collections, which we |
| 7 * provide here until an implementation is available in the regular libraries. | 7 * provide here until an implementation is available in the regular libraries. |
| 8 */ | 8 */ |
| 9 // TODO(alanknight): Remove once identity-hashed collections are available. | 9 // TODO(alanknight): Remove once identity-hashed collections are available. |
| 10 // Issue 4161. | 10 // Issue 4161. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 expect(map.length, 1); | 33 expect(map.length, 1); |
| 34 expect(identityMap.length, 2); | 34 expect(identityMap.length, 2); |
| 35 for (var each in identityMap.values) { | 35 for (var each in identityMap.values) { |
| 36 expect(each, one); | 36 expect(each, one); |
| 37 } | 37 } |
| 38 }); | 38 }); |
| 39 | 39 |
| 40 test('uniquing primitives', () { | 40 test('uniquing primitives', () { |
| 41 var map = new IdentityMap(); | 41 var map = new IdentityMap(); |
| 42 var one = 'one'; | 42 var one = 'one'; |
| 43 var two = new String.fromCharCodes(one.charCodes); | 43 var two = new String.fromCharCodes(one.codeUnits); |
| 44 map[one] = 1; | 44 map[one] = 1; |
| 45 expect(map[two], 1); | 45 expect(map[two], 1); |
| 46 expect(map[one], 1); | 46 expect(map[one], 1); |
| 47 }); | 47 }); |
| 48 } | 48 } |
| OLD | NEW |