OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 | |
7 class A { | |
8 const A(); | |
9 bool operator ==(Object other) { | |
10 return false; | |
11 } | |
12 } | |
13 | |
14 class B { | |
15 bool operator ==(Object other) { | |
16 Expect.fail("Bad equality order."); | |
17 } | |
18 } | |
19 | |
20 main() { | |
21 test(iterable) { | |
22 Expect.isFalse(iterable.contains(new B())); | |
23 } | |
24 | |
25 var iterables = [ | |
26 <A>[new A()], | |
27 new List<A>(1)..[0] = new A(), | |
28 new List<A>()..add(new A()), | |
29 const <A>[const A()], | |
30 new Set()..add(new A()), | |
31 (new Map()..[new A()] = 0).keys, | |
32 (new Map()..[0] = new A()).values | |
33 ]; | |
34 | |
35 for (var iterable in iterables) { | |
36 test(iterable); | |
37 test(iterable.map((x) => x)); | |
38 test(iterable.take(1)); | |
39 } | |
40 } | |
OLD | NEW |