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

Unified Diff: packages/collection/test/equality_map_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/collection/test/comparators_test.dart ('k') | packages/collection/test/equality_set_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/collection/test/equality_map_test.dart
diff --git a/packages/collection/test/equality_map_test.dart b/packages/collection/test/equality_map_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8225efd7856cf1f10af0f7ada91b5b7729848f24
--- /dev/null
+++ b/packages/collection/test/equality_map_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:collection/collection.dart';
+import 'package:test/test.dart';
+
+void main() {
+ test("uses the given equality", () {
+ var map = new EqualityMap(const IterableEquality());
+ expect(map, isEmpty);
+
+ map[[1, 2, 3]] = 1;
+ expect(map, containsPair([1, 2, 3], 1));
+
+ map[[1, 2, 3]] = 2;
+ expect(map, containsPair([1, 2, 3], 2));
+
+ map[[2, 3, 4]] = 3;
+ expect(map, containsPair([1, 2, 3], 2));
+ expect(map, containsPair([2, 3, 4], 3));
+ });
+
+ test("EqualityMap.from() prefers the lattermost equivalent key", () {
+ var map = new EqualityMap.from(const IterableEquality(), {
+ [1, 2, 3]: 1,
+ [2, 3, 4]: 2,
+ [1, 2, 3]: 3,
+ [2, 3, 4]: 4,
+ [1, 2, 3]: 5,
+ [1, 2, 3]: 6,
+ });
+
+ expect(map, containsPair([1, 2, 3], 6));
+ expect(map, containsPair([2, 3, 4], 4));
+ });
+}
« no previous file with comments | « packages/collection/test/comparators_test.dart ('k') | packages/collection/test/equality_set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698