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