Index: tests/corelib/map_test.dart |
diff --git a/tests/corelib/map_test.dart b/tests/corelib/map_test.dart |
index a70002720d8e1662683ba1269a90b7cd44528deb..7e9d50db7707428403e4492518360a2ad988bc9f 100644 |
--- a/tests/corelib/map_test.dart |
+++ b/tests/corelib/map_test.dart |
@@ -456,8 +456,24 @@ void testNaNKeys(Map map) { |
void testLength(int length, Map map) { |
Expect.equals(length, map.length); |
- (length == 0 ? Expect.isTrue : Expect.isFalse)(map.isEmpty); |
- (length != 0 ? Expect.isTrue : Expect.isFalse)(map.isNotEmpty); |
+ Expect.equals(length, map.keys.length); |
+ Expect.equals(length, map.values.length); |
+ // Check being-empty. |
+ var ifEmpty = (length == 0) ? Expect.isTrue : Expect.isFalse; |
+ var ifNotEmpty = (length != 0) ? Expect.isTrue : Expect.isFalse; |
+ ifEmpty(map.isEmpty); |
+ ifNotEmpty(map.isNotEmpty); |
+ ifEmpty(map.keys.isEmpty); |
+ ifNotEmpty(map.keys.isNotEmpty); |
+ ifEmpty(map.values.isEmpty); |
+ ifNotEmpty(map.values.isNotEmpty); |
+ // Test key/value iterators match their isEmpty/isNotEmpty. |
+ ifNotEmpty(map.keys.iterator.moveNext()); |
+ ifNotEmpty(map.values.iterator.moveNext()); |
+ if (length == 0) { |
+ for (var k in map.keys) Expect.fail("contains key when iterating: $k"); |
+ for (var v in map.values) Expect.fail("contains values when iterating: $v"); |
+ } |
} |