| 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"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 List<int> list1 = <int>[1, 2, 3]; | 8 List<int> list1 = <int>[1, 2, 3]; |
| 9 List<int> list2 = const <int>[4, 4]; | 9 List<int> list2 = const <int>[4, 4]; |
| 10 List<String> list3 = <String>[]; | 10 List<String> list3 = <String>[]; |
| 11 Set<int> set1 = new Set<int>(); | 11 Set<int> set1 = new Set<int>(); |
| 12 set1..add(11) | 12 set1..add(11)..add(12)..add(13); |
| 13 ..add(12) | |
| 14 ..add(13); | |
| 15 Set<String> set2 = new Set<String>(); | 13 Set<String> set2 = new Set<String>(); |
| 16 set2..add("foo") | 14 set2..add("foo")..add("bar")..add("toto"); |
| 17 ..add("bar") | |
| 18 ..add("toto"); | |
| 19 Set set3 = new Set(); | 15 Set set3 = new Set(); |
| 20 | 16 |
| 21 var setCopy = list1.toSet(); | 17 var setCopy = list1.toSet(); |
| 22 Expect.equals(3, setCopy.length); | 18 Expect.equals(3, setCopy.length); |
| 23 Expect.isTrue(setCopy.contains(1)); | 19 Expect.isTrue(setCopy.contains(1)); |
| 24 Expect.isTrue(setCopy.contains(2)); | 20 Expect.isTrue(setCopy.contains(2)); |
| 25 Expect.isTrue(setCopy.contains(3)); | 21 Expect.isTrue(setCopy.contains(3)); |
| 26 Expect.isTrue(setCopy is Set<int>); | 22 Expect.isTrue(setCopy is Set<int>); |
| 27 Expect.isFalse(setCopy is Set<String>); | 23 Expect.isFalse(setCopy is Set<String>); |
| 28 | 24 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 Expect.isTrue(setCopy is Set<String>); | 44 Expect.isTrue(setCopy is Set<String>); |
| 49 Expect.isFalse(setCopy is Set<int>); | 45 Expect.isFalse(setCopy is Set<int>); |
| 50 Expect.isFalse(identical(setCopy, set2)); | 46 Expect.isFalse(identical(setCopy, set2)); |
| 51 | 47 |
| 52 setCopy = set3.toSet(); | 48 setCopy = set3.toSet(); |
| 53 Expect.setEquals(set3, setCopy); | 49 Expect.setEquals(set3, setCopy); |
| 54 Expect.isTrue(setCopy is Set<String>); | 50 Expect.isTrue(setCopy is Set<String>); |
| 55 Expect.isTrue(setCopy is Set<int>); | 51 Expect.isTrue(setCopy is Set<int>); |
| 56 Expect.isFalse(identical(setCopy, set3)); | 52 Expect.isFalse(identical(setCopy, set3)); |
| 57 } | 53 } |
| OLD | NEW |