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

Unified Diff: tests/corelib/map_from_test.dart

Issue 22859069: Reapply "Make Map constructors return LinkedHashMap." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make map_values2_test know the order. Created 7 years, 4 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/map_from_iterables_test.dart ('k') | tests/corelib/map_values2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/map_from_test.dart
diff --git a/tests/corelib/map_from_test.dart b/tests/corelib/map_from_test.dart
index 21597fbef38dd38fde9f0aa0ce85fdebc55cd88a..736ead08162100dab5a40a19cdea6df39cd2fea5 100644
--- a/tests/corelib/map_from_test.dart
+++ b/tests/corelib/map_from_test.dart
@@ -9,6 +9,7 @@ import 'dart:collection';
main() {
testWithConstMap();
testWithNonConstMap();
+ testWithHashMap();
testWithLinkedMap();
}
@@ -17,7 +18,7 @@ testWithConstMap() {
var otherMap = new Map.from(map);
Expect.isTrue(otherMap is Map);
Expect.isTrue(otherMap is HashMap);
- Expect.isTrue(otherMap is !LinkedHashMap);
+ Expect.isTrue(otherMap is LinkedHashMap);
Expect.equals(2, otherMap.length);
Expect.equals(2, otherMap.keys.length);
@@ -38,7 +39,7 @@ testWithNonConstMap() {
var otherMap = new Map.from(map);
Expect.isTrue(otherMap is Map);
Expect.isTrue(otherMap is HashMap);
- Expect.isTrue(otherMap is !LinkedHashMap);
+ Expect.isTrue(otherMap is LinkedHashMap);
Expect.equals(2, otherMap.length);
Expect.equals(2, otherMap.keys.length);
@@ -68,11 +69,23 @@ testWithNonConstMap() {
Expect.equals(3, otherMap.values.length);
}
+testWithHashMap() {
+ var map = const { 'b': 1, 'a': 2, 'c': 3 };
+ var otherMap = new HashMap.from(map);
+ Expect.isTrue(otherMap is Map);
+ Expect.isTrue(otherMap is HashMap);
+ Expect.isTrue(otherMap is !LinkedHashMap);
+ var i = 1;
+ for (var val in map.values) {
+ Expect.equals(i++, val);
+ }
+}
+
testWithLinkedMap() {
var map = const { 'b': 1, 'a': 2, 'c': 3 };
var otherMap = new LinkedHashMap.from(map);
Expect.isTrue(otherMap is Map);
- Expect.isTrue(otherMap is! HashMap);
+ Expect.isTrue(otherMap is HashMap);
Expect.isTrue(otherMap is LinkedHashMap);
var i = 1;
for (var val in map.values) {
« no previous file with comments | « tests/corelib/map_from_iterables_test.dart ('k') | tests/corelib/map_values2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698