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

Side by Side Diff: test/map_mixin_test.dart

Issue 2019423002: Make PbMapMixin implement Map<String, dynamic> (Closed) Base URL: https://github.com/dart-lang/dart-protobuf.git@master
Patch Set: nits Created 4 years, 6 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
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 // Unit tests for PbMapMixin. 6 // Unit tests for PbMapMixin.
7 // There are more tests in the dart-protoc-plugin package. 7 // There are more tests in the dart-protoc-plugin package.
8 library map_mixin_test; 8 library map_mixin_test;
9 9
10 import 'dart:collection' show MapMixin; 10 import 'dart:collection' show MapMixin;
11 11
12 import 'package:protobuf/src/protobuf/mixins/map_mixin.dart'; 12 import 'package:protobuf/src/protobuf/mixins/map_mixin.dart';
13 import 'package:test/test.dart' show test, expect, same, throws; 13 import 'package:test/test.dart' show test, expect, same, throws;
14 14
15 import 'mock_util.dart' show MockMessage, mockInfo; 15 import 'mock_util.dart' show MockMessage, mockInfo;
16 16
17 // A minimal protobuf implementation compatible with PbMapMixin. 17 // A minimal protobuf implementation compatible with PbMapMixin.
18 class Rec extends MockMessage with MapMixin, PbMapMixin { 18 class Rec extends MockMessage with MapMixin<String, dynamic>, PbMapMixin {
19 get info_ => _info; 19 get info_ => _info;
20 static final _info = mockInfo("Rec", () => new Rec()); 20 static final _info = mockInfo("Rec", () => new Rec());
21 21
22 @override 22 @override
23 String toString() => "Rec(${val}, \"${str}\")"; 23 String toString() => "Rec(${val}, \"${str}\")";
24 } 24 }
25 25
26 main() { 26 main() {
27 test('PbMapMixin methods return default field values', () { 27 test('PbMapMixin methods return default field values', () {
28 var r = new Rec(); 28 var r = new Rec();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 }); 97 });
98 98
99 test("reading protobuf values shouldn't change equality", () { 99 test("reading protobuf values shouldn't change equality", () {
100 var a = new Rec(); 100 var a = new Rec();
101 var b = new Rec(); 101 var b = new Rec();
102 expect(a == b, true); 102 expect(a == b, true);
103 new Map.from(a); 103 new Map.from(a);
104 expect(a == b, true); 104 expect(a == b, true);
105 }); 105 });
106 } 106 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698