OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class A { | 7 class A { |
8 const A(); | 8 const A(); |
9 foo() => 42; | 9 foo() => 42; |
10 } | 10 } |
(...skipping 15 matching lines...) Expand all Loading... |
26 Expect.equals(array[i], array[i]); | 26 Expect.equals(array[i], array[i]); |
27 Expect.equals(array[i].foo, array[i].foo); | 27 Expect.equals(array[i].foo, array[i].foo); |
28 Expect.equals(array[i].foo.hashCode, array[i].foo.hashCode); | 28 Expect.equals(array[i].foo.hashCode, array[i].foo.hashCode); |
29 for (int j = 0; j < array.length; j++) { | 29 for (int j = 0; j < array.length; j++) { |
30 if (i == j) continue; | 30 if (i == j) continue; |
31 Expect.notEquals(array[i].foo, array[j].foo); | 31 Expect.notEquals(array[i].foo, array[j].foo); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 // Try with dart2js intercepted types. | 35 // Try with dart2js intercepted types. |
36 array = ['foo', 'bar', [], [], const []]; | 36 array = ['foo', 'bar', [], [], const []]; |
37 set = new Set.from(array.map((a) => a.indexOf)); | 37 set = new Set.from(array.map((a) => a.indexOf)); |
38 Expect.equals(array.length, set.length); | 38 Expect.equals(array.length, set.length); |
39 set.addAll(array.map((a) => a.indexOf)); | 39 set.addAll(array.map((a) => a.indexOf)); |
40 Expect.equals(array.length, set.length); | 40 Expect.equals(array.length, set.length); |
41 | 41 |
42 for (int i = 0; i < array.length; i += 2) { | 42 for (int i = 0; i < array.length; i += 2) { |
43 Expect.isTrue(set.contains(array[i].indexOf)); | 43 Expect.isTrue(set.contains(array[i].indexOf)); |
44 Expect.equals(array[i], array[i]); | 44 Expect.equals(array[i], array[i]); |
45 Expect.equals(array[i].indexOf, array[i].indexOf); | 45 Expect.equals(array[i].indexOf, array[i].indexOf); |
46 Expect.equals(array[i].indexOf.hashCode, array[i].indexOf.hashCode); | 46 Expect.equals(array[i].indexOf.hashCode, array[i].indexOf.hashCode); |
(...skipping 20 matching lines...) Expand all Loading... |
67 Expect.equals(1, set.length); | 67 Expect.equals(1, set.length); |
68 set.addAll(array.map((a) => a.indexOf)); | 68 set.addAll(array.map((a) => a.indexOf)); |
69 Expect.equals(1, set.length); | 69 Expect.equals(1, set.length); |
70 | 70 |
71 Expect.isTrue(set.contains(array[0].indexOf)); | 71 Expect.isTrue(set.contains(array[0].indexOf)); |
72 Expect.equals(array[0].indexOf, array[0].indexOf); | 72 Expect.equals(array[0].indexOf, array[0].indexOf); |
73 Expect.equals(array[0].indexOf.hashCode, array[0].indexOf.hashCode); | 73 Expect.equals(array[0].indexOf.hashCode, array[0].indexOf.hashCode); |
74 Expect.equals(array[0].indexOf, array[1].indexOf); | 74 Expect.equals(array[0].indexOf, array[1].indexOf); |
75 Expect.equals(array[0].indexOf.hashCode, array[1].indexOf.hashCode); | 75 Expect.equals(array[0].indexOf.hashCode, array[1].indexOf.hashCode); |
76 } | 76 } |
OLD | NEW |