Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: tests/corelib/map_test.dart

Issue 24104003: Reapply "Convert HashSet, LinkedHashSet to factory methods and custom implementations." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Punctuation and whitespace. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/hash_set_test.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
+ }
}
« no previous file with comments | « tests/corelib/hash_set_test.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698