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

Side by Side Diff: test/event_test.dart

Issue 1852983002: Fix issues with protobuf equality comparisons (Closed) Base URL: git@github.com:dart-lang/dart-protobuf.git@master
Patch Set: tweak _deepEquals, improve tests Created 4 years, 8 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 | « lib/src/protobuf/utils.dart ('k') | test/json_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Tests event delivery using PbEventMixin. 5 /// Tests event delivery using PbEventMixin.
6 library event_test; 6 library event_test;
7 7
8 import 'dart:typed_data' show Uint8List; 8 import 'dart:typed_data' show Uint8List;
9 9
10 import 'package:protobuf/protobuf.dart' 10 import 'package:protobuf/protobuf.dart'
11 show GeneratedMessage, Extension, ExtensionRegistry, PbFieldType; 11 show GeneratedMessage, Extension, ExtensionRegistry, PbFieldType;
12 import 'package:protobuf/src/protobuf/mixins/event_mixin.dart' 12 import 'package:protobuf/src/protobuf/mixins/event_mixin.dart'
13 show PbEventMixin, PbFieldChange; 13 show PbEventMixin, PbFieldChange;
14 import 'package:test/test.dart' show test, expect, predicate, same; 14 import 'package:test/test.dart' show test, expect, predicate, same;
15 15
16 import 'mock_util.dart' show MockMessage; 16 import 'mock_util.dart' show MockMessage, mockInfo;
17 17
18 class Rec extends MockMessage with PbEventMixin { 18 class Rec extends MockMessage with PbEventMixin {
19 get className => "Rec"; 19 get info_ => _info;
20 Rec create() => new Rec(); 20 static final _info = mockInfo("Rec", () => new Rec());
21 } 21 }
22 22
23 Extension comment = new Extension("Rec", "comment", 5, PbFieldType.OS); 23 Extension comment = new Extension("Rec", "comment", 5, PbFieldType.OS);
24 24
25 main() { 25 main() {
26 test('Events are sent when setting and clearing a non-repeated field', () { 26 test('Events are sent when setting and clearing a non-repeated field', () {
27 var log = makeLog(); 27 var log = makeLog();
28 var r = new Rec(); 28 var r = new Rec();
29 r.changes.listen((List<PbFieldChange> changes) { 29 r.changes.listen((List<PbFieldChange> changes) {
30 log.add(changes); 30 log.add(changes);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 List toTuple(PbFieldChange fc) { 292 List toTuple(PbFieldChange fc) {
293 fixValue(v) { 293 fixValue(v) {
294 if (v is GeneratedMessage) { 294 if (v is GeneratedMessage) {
295 return "<msg>"; 295 return "<msg>";
296 } 296 }
297 return v; 297 return v;
298 } 298 }
299 return [fc.tag, fixValue(fc.oldValue), fixValue(fc.newValue)]; 299 return [fc.tag, fixValue(fc.oldValue), fixValue(fc.newValue)];
300 } 300 }
OLDNEW
« no previous file with comments | « lib/src/protobuf/utils.dart ('k') | test/json_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698