| Index: pkg/dev_compiler/test/codegen/expect.dart
|
| diff --git a/pkg/dev_compiler/test/codegen/expect.dart b/pkg/dev_compiler/test/codegen/expect.dart
|
| index 555aee8384e9ea22029e0441dcd7bab2b487ade8..4ee2832d383bb10203d22ad7edcd9c98648aa0b5 100644
|
| --- a/pkg/dev_compiler/test/codegen/expect.dart
|
| +++ b/pkg/dev_compiler/test/codegen/expect.dart
|
| @@ -350,26 +350,32 @@ class Expect {
|
| /**
|
| * Checks that [expected] is equivalent to [actual].
|
| *
|
| - * If the objects are lists or maps, recurses into them.
|
| + * If the objects are iterables or maps, recurses into them.
|
| */
|
| static void deepEquals(Object expected, Object actual) {
|
| // Early exit check for equality.
|
| if (expected == actual) return;
|
|
|
| - if (expected is List && actual is List) {
|
| - int n =
|
| - (expected.length < actual.length) ? expected.length : actual.length;
|
| - for (int i = 0; i < n; i++) {
|
| - deepEquals(expected[i], actual[i]);
|
| + if (expected is String && actual is String) {
|
| + stringEquals(expected, actual);
|
| + } else if (expected is Iterable && actual is Iterable) {
|
| + var expectedLength = expected.length;
|
| + var actualLength = actual.length;
|
| +
|
| + var length =
|
| + expectedLength < actualLength ? expectedLength : actualLength;
|
| + for (var i = 0; i < length; i++) {
|
| + deepEquals(expected.elementAt(i), actual.elementAt(i));
|
| }
|
|
|
| // We check on length at the end in order to provide better error
|
| // messages when an unexpected item is inserted in a list.
|
| - if (expected.length != actual.length) {
|
| + if (expectedLength != actualLength) {
|
| + var nextElement =
|
| + (expectedLength > length ? expected : actual).elementAt(length);
|
| _fail('Expect.deepEquals(list length, '
|
| - 'expected: <${expected.length}>, actual: <${actual.length}>) '
|
| - 'fails: Next element <'
|
| - '${expected.length > n ? expected[n] : actual[n]}>');
|
| + 'expected: <$expectedLength>, actual: <$actualLength>) '
|
| + 'fails: Next element <$nextElement>');
|
| }
|
| } else if (expected is Map && actual is Map) {
|
| // Make sure all of the values are present in both and match.
|
| @@ -387,11 +393,6 @@ class Expect {
|
| _fail('Expect.deepEquals(unexpected key: <$key>) fails');
|
| }
|
| }
|
| - } else if (expected is String && actual is String) {
|
| - String stringDifference = _stringDifference(expected, actual);
|
| - // If we get here, they should not be equal.
|
| - assert(stringDifference != null);
|
| - _fail("Expect.deepEquals($stringDifference) fails.");
|
| } else {
|
| _fail("Expect.deepEquals(expected: <$expected>, actual: <$actual>) "
|
| "fails.");
|
|
|