OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 indexOf(item) => 42; | 9 indexOf(item) => 42; |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 if (a is A) return getIndexOfA(a); | 25 if (a is A) return getIndexOfA(a); |
26 | 26 |
27 return a.indexOf; | 27 return a.indexOf; |
28 }; | 28 }; |
29 | 29 |
30 var inscrutable; | 30 var inscrutable; |
31 | 31 |
32 main() { | 32 main() { |
33 inscrutable = (x) => x; | 33 inscrutable = (x) => x; |
34 | 34 |
35 var array = ['foo', 'bar', [] , [], new A(), new A(), const [], const A()]; | 35 var array = ['foo', 'bar', [], [], new A(), new A(), const [], const A()]; |
36 | 36 |
37 array = inscrutable(array); | 37 array = inscrutable(array); |
38 getter1 = inscrutable(getter1); | 38 getter1 = inscrutable(getter1); |
39 getter2 = inscrutable(getter2); | 39 getter2 = inscrutable(getter2); |
40 getIndexOfA = inscrutable(getIndexOfA); | 40 getIndexOfA = inscrutable(getIndexOfA); |
41 | 41 |
42 var set = new Set.from(array.map(getter1)); | 42 var set = new Set.from(array.map(getter1)); |
43 | 43 |
44 // Closures should be distinct since they are closures bound to distinct | 44 // Closures should be distinct since they are closures bound to distinct |
45 // objects. | 45 // objects. |
(...skipping 25 matching lines...) Expand all Loading... |
71 for (int j = 0; j < array.length; j++) { | 71 for (int j = 0; j < array.length; j++) { |
72 if (i == j) continue; | 72 if (i == j) continue; |
73 | 73 |
74 Expect.notEquals(getter1(array[i]), getter1(array[j])); | 74 Expect.notEquals(getter1(array[i]), getter1(array[j])); |
75 Expect.notEquals(getter1(array[i]), getter2(array[j])); | 75 Expect.notEquals(getter1(array[i]), getter2(array[j])); |
76 Expect.notEquals(getter2(array[i]), getter1(array[j])); | 76 Expect.notEquals(getter2(array[i]), getter1(array[j])); |
77 Expect.notEquals(getter2(array[i]), getter2(array[j])); | 77 Expect.notEquals(getter2(array[i]), getter2(array[j])); |
78 } | 78 } |
79 } | 79 } |
80 } | 80 } |
OLD | NEW |