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

Side by Side Diff: packages/collection/test/combined_wrapper/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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:collection/collection.dart';
6 import 'package:test/test.dart';
7
8 import '../unmodifiable_collection_test.dart' as common;
9
10 void main() {
11 var map1 = const {1: 1, 2: 2, 3: 3};
12 var map2 = const {4: 4, 5: 5, 6: 6};
13 var map3 = const {7: 7, 8: 8, 9: 9};
14 var concat = {}..addAll(map1)..addAll(map2)..addAll(map3);
15
16 // In every way possible this should test the same as an UnmodifiableMapView.
17 common.testReadMap(
18 concat, new CombinedMapView([map1, map2, map3]), 'CombinedMapView');
19
20 common.testReadMap(
21 concat,
22 new CombinedMapView([map1, {}, map2, {}, map3, {}]),
23 'CombinedMapView (some empty)');
24
25 test('should function as an empty map when no maps are passed', () {
26 var empty = new CombinedMapView([]);
27 expect(empty, isEmpty);
28 expect(empty.length, 0);
29 });
30
31 test('should function as an empty map when only empty maps are passed', () {
32 var empty = new CombinedMapView([{}, {}, {}]);
33 expect(empty, isEmpty);
34 expect(empty.length, 0);
35 });
36
37 test('should reflect underlying changes back to the combined map', () {
38 var backing1 = <int, int>{};
39 var backing2 = <int, int>{};
40 var combined = new CombinedMapView([backing1, backing2]);
41 expect(combined, isEmpty);
42 backing1.addAll(map1);
43 expect(combined, map1);
44 backing2.addAll(map2);
45 expect(combined, new Map.from(backing1)..addAll(backing2));
46 });
47
48 test('should reflect underlying changes with a single map', () {
49 var backing1 = <int, int>{};
50 var combined = new CombinedMapView([backing1]);
51 expect(combined, isEmpty);
52 backing1.addAll(map1);
53 expect(combined, map1);
54 });
55 }
OLDNEW
« no previous file with comments | « packages/collection/test/combined_wrapper/list_test.dart ('k') | packages/collection/test/comparators_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698