| Index: tests/corelib_strong/set_test.dart
|
| diff --git a/tests/corelib_strong/set_test.dart b/tests/corelib_strong/set_test.dart
|
| index 71f30c4bb2628268973a635e15e3e824e147b851..e50f0559046556275bf7b1e48bcbcc2ace107e69 100644
|
| --- a/tests/corelib_strong/set_test.dart
|
| +++ b/tests/corelib_strong/set_test.dart
|
| @@ -4,7 +4,6 @@
|
|
|
| library set_test;
|
|
|
| -
|
| import 'package:expect/expect.dart';
|
| import "dart:collection";
|
|
|
| @@ -213,7 +212,7 @@ void testInts(Set create()) {
|
| testLength(4, set2);
|
| Expect.listEquals(set.toList(), set2.toList());
|
|
|
| - set2 = (set.toSet()..clear()).toSet(); // Cloning empty set shouldn't fail.
|
| + set2 = (set.toSet()..clear()).toSet(); // Cloning empty set shouldn't fail.
|
| testLength(0, set2);
|
| }
|
|
|
| @@ -222,7 +221,9 @@ void testLength(int length, Set set) {
|
| (length == 0 ? Expect.isTrue : Expect.isFalse)(set.isEmpty);
|
| (length != 0 ? Expect.isTrue : Expect.isFalse)(set.isNotEmpty);
|
| if (length == 0) {
|
| - for (var e in set) { Expect.fail("contains element when iterated: $e"); }
|
| + for (var e in set) {
|
| + Expect.fail("contains element when iterated: $e");
|
| + }
|
| }
|
| (length == 0 ? Expect.isFalse : Expect.isTrue)(set.iterator.moveNext());
|
| }
|
| @@ -281,7 +282,7 @@ void testRetainWhere(Set create([equals, hashCode, validKey, compare])) {
|
| // during development).
|
| Set set = create();
|
| set.addAll([new CE(0), new CE(1), new CE(2)]);
|
| - Expect.equals(3, set.length); // All different.
|
| + Expect.equals(3, set.length); // All different.
|
| set.retainAll([new CE(0), new CE(2)]);
|
| Expect.equals(2, set.length);
|
| Expect.isTrue(set.contains(new CE(0)));
|
| @@ -325,7 +326,7 @@ void testDifferenceIntersection(create([equals, hashCode, validKey, compare])) {
|
| CE ce1b = new CE(1);
|
| CE ce2 = new CE(2);
|
| CE ce3 = new CE(3);
|
| - Expect.equals(ce1a, ce1b); // Sanity check.
|
| + Expect.equals(ce1a, ce1b); // Sanity check.
|
|
|
| var set1 = create();
|
| var set2 = create();
|
| @@ -346,7 +347,7 @@ void testDifferenceIntersection(create([equals, hashCode, validKey, compare])) {
|
| var set3 = create(identical, identityHashCode, null, identityCompare);
|
| set3.add(ce1b);
|
| difference = set1.difference(set3);
|
| - testLength(2, difference); // ce1a is not identical to element in set3.
|
| + testLength(2, difference); // ce1a is not identical to element in set3.
|
| Expect.identical(ce1a, difference.lookup(ce1a));
|
| Expect.identical(ce2, difference.lookup(ce2));
|
|
|
| @@ -364,7 +365,7 @@ class CE implements Comparable<CE> {
|
| final int id;
|
| const CE(this.id);
|
| int get hashCode => id;
|
| - bool operator==(Object other) => other is CE && id == (other as CE).id;
|
| + bool operator ==(Object other) => other is CE && id == (other as CE).id;
|
| int compareTo(CE other) => id - other.id;
|
| String toString() => "CE($id)";
|
| }
|
| @@ -373,8 +374,8 @@ typedef int CECompare(CE e1, CE e2);
|
| // Equality of Id objects based on id modulo value.
|
| Function customEq(int mod) => (CE e1, CE e2) => ((e1.id - e2.id) % mod) == 0;
|
| Function customHash(int mod) => (CE e) => e.id % mod;
|
| -CECompare customCompare(int mod) => (CE e1, CE e2) =>
|
| - (e1.id % mod) - (e2.id % mod);
|
| +CECompare customCompare(int mod) =>
|
| + (CE e1, CE e2) => (e1.id % mod) - (e2.id % mod);
|
| bool validKey(Object o) => o is CE;
|
| final customId = new Map<dynamic, dynamic>.identity();
|
| int counter = 0;
|
| @@ -428,8 +429,14 @@ void testIntSetFrom(setFrom) {
|
| }
|
|
|
| void testCESetFrom(setFrom) {
|
| - var ceList = [new CE(2), new CE(3), new CE(5),
|
| - new CE(7), new CE(11), new CE(13)];
|
| + var ceList = [
|
| + new CE(2),
|
| + new CE(3),
|
| + new CE(5),
|
| + new CE(7),
|
| + new CE(11),
|
| + new CE(13)
|
| + ];
|
|
|
| Set<CE> set1 = setFrom(ceList);
|
| Expect.listEquals(ceList, set1.toList()..sort());
|
| @@ -447,11 +454,13 @@ void testCESetFrom(setFrom) {
|
| }
|
|
|
| class A {}
|
| +
|
| class B {}
|
| +
|
| class C implements A, B {}
|
|
|
| void testASetFrom(setFrom) {
|
| - List<B> bList= <B>[new C()];
|
| + List<B> bList = <B>[new C()];
|
| // Set.from allows to cast elements.
|
| Set<A> aSet = setFrom(bList);
|
| Expect.isTrue(aSet.length == 1);
|
| @@ -464,9 +473,10 @@ main() {
|
| testMain(() => new LinkedHashSet.identity());
|
| testMain(() => new HashSet(equals: identical));
|
| testMain(() => new LinkedHashSet(equals: identical));
|
| - testMain(() => new HashSet(equals: (a, b) => a == b,
|
| - hashCode: (a) => -a.hashCode,
|
| - isValidKey: (a) => true));
|
| + testMain(() => new HashSet(
|
| + equals: (a, b) => a == b,
|
| + hashCode: (a) => -a.hashCode,
|
| + isValidKey: (a) => true));
|
| testMain(() => new LinkedHashSet(
|
| equals: (a, b) => a == b,
|
| hashCode: (a) => -a.hashCode,
|
| @@ -483,27 +493,29 @@ main() {
|
| testTypeAnnotations(new LinkedHashSet<int>());
|
| testTypeAnnotations(new HashSet<int>(equals: identical));
|
| testTypeAnnotations(new LinkedHashSet<int>(equals: identical));
|
| - testTypeAnnotations(new HashSet<int>(equals: (int a, int b) => a == b,
|
| - hashCode: (int a) => a.hashCode,
|
| - isValidKey: (a) => a is int));
|
| - testTypeAnnotations(new LinkedHashSet<int>(equals: (int a, int b) => a == b,
|
| - hashCode: (int a) => a.hashCode,
|
| - isValidKey: (a) => a is int));
|
| + testTypeAnnotations(new HashSet<int>(
|
| + equals: (int a, int b) => a == b,
|
| + hashCode: (int a) => a.hashCode,
|
| + isValidKey: (a) => a is int));
|
| + testTypeAnnotations(new LinkedHashSet<int>(
|
| + equals: (int a, int b) => a == b,
|
| + hashCode: (int a) => a.hashCode,
|
| + isValidKey: (a) => a is int));
|
| testTypeAnnotations(new SplayTreeSet<int>());
|
|
|
| testRetainWhere(([equals, hashCode, validKey, comparator]) =>
|
| new HashSet(equals: equals, hashCode: hashCode, isValidKey: validKey));
|
| testRetainWhere(([equals, hashCode, validKey, comparator]) =>
|
| - new LinkedHashSet(equals: equals, hashCode: hashCode,
|
| - isValidKey: validKey));
|
| + new LinkedHashSet(
|
| + equals: equals, hashCode: hashCode, isValidKey: validKey));
|
| testRetainWhere(([equals, hashCode, validKey, comparator]) =>
|
| new SplayTreeSet(comparator, validKey));
|
|
|
| testDifferenceIntersection(([equals, hashCode, validKey, comparator]) =>
|
| new HashSet(equals: equals, hashCode: hashCode, isValidKey: validKey));
|
| testDifferenceIntersection(([equals, hashCode, validKey, comparator]) =>
|
| - new LinkedHashSet(equals: equals, hashCode: hashCode,
|
| - isValidKey: validKey));
|
| + new LinkedHashSet(
|
| + equals: equals, hashCode: hashCode, isValidKey: validKey));
|
| testDifferenceIntersection(([equals, hashCode, validKey, comparator]) =>
|
| new SplayTreeSet(comparator, validKey));
|
|
|
| @@ -517,8 +529,8 @@ main() {
|
| testCESetFrom((x) => new LinkedHashSet<CE>.from(x));
|
| testCESetFrom((x) => new SplayTreeSet<CE>.from(x));
|
|
|
| - testCESetFrom((x) => new SplayTreeSet<CE>.from(x,
|
| - customCompare(20), validKey));
|
| + testCESetFrom(
|
| + (x) => new SplayTreeSet<CE>.from(x, customCompare(20), validKey));
|
| testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare));
|
|
|
| testASetFrom((x) => new Set<A>.from(x));
|
|
|