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"; |
| 6 |
5 // dart2js specific test to make sure hashCode on intercepted types behaves as | 7 // dart2js specific test to make sure hashCode on intercepted types behaves as |
6 // intended. | 8 // intended. |
7 | 9 |
8 | 10 |
9 class Hasher { | 11 class Hasher { |
10 confuse(x) => [1, 'x', true, null, x].last; | 12 confuse(x) => [1, 'x', true, null, x].last; |
11 hash(x) => confuse(x).hashCode; | 13 hash(x) => confuse(x).hashCode; |
12 } | 14 } |
13 | 15 |
14 // Hashing via [hash] should be forced to use the general interceptor, but the | 16 // Hashing via [hash] should be forced to use the general interceptor, but the |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Expect.equals(0x0DB819B, 'b'.hashCode); | 74 Expect.equals(0x0DB819B, 'b'.hashCode); |
73 Expect.equals(0xEBA5D59, 'c'.hashCode); | 75 Expect.equals(0xEBA5D59, 'c'.hashCode); |
74 } | 76 } |
75 | 77 |
76 main() { | 78 main() { |
77 bools(); | 79 bools(); |
78 ints(); | 80 ints(); |
79 lists(); | 81 lists(); |
80 strings(); | 82 strings(); |
81 } | 83 } |
OLD | NEW |