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

Side by Side Diff: test/message_test.dart

Issue 1852983002: Fix issues with protobuf equality comparisons (Closed) Base URL: git@github.com:dart-lang/dart-protobuf.git@master
Patch Set: 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
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 for GeneratedMessage methods. 5 /// Tests for GeneratedMessage methods.
6 library message_test; 6 library message_test;
7 7
8 import 'package:test/test.dart' show test, expect, predicate, throwsA; 8 import 'package:test/test.dart' show test, expect, predicate, throwsA;
9 9
10 import 'mock_util.dart' show MockMessage; 10 import 'mock_util.dart' show MockMessage, mockInfo;
11 11
12 class Rec extends MockMessage { 12 class Rec extends MockMessage {
13 get className => "Rec"; 13 get info_ => _info;
14 Rec create() => new Rec(); 14 static final _info = mockInfo("Rec", () => new Rec());
15 } 15 }
16 16
17 throwsError(Type expectedType, String expectedMessage) => throwsA( 17 throwsError(Type expectedType, String expectedMessage) =>
18 predicate((x) { 18 throwsA(predicate((x) {
19 expect(x.runtimeType, expectedType); 19 expect(x.runtimeType, expectedType);
20 expect(x.message, expectedMessage); 20 expect(x.message, expectedMessage);
21 return true; 21 return true;
22 })); 22 }));
23 23
24 main() { 24 main() {
25 test('getField with invalid tag throws exception', () { 25 test('getField with invalid tag throws exception', () {
26 var r = new Rec(); 26 var r = new Rec();
27 expect(() { 27 expect(() {
28 r.getField(123); 28 r.getField(123);
29 }, throwsError(ArgumentError, "tag 123 not defined in Rec")); 29 }, throwsError(ArgumentError, "tag 123 not defined in Rec"));
30 }); 30 });
31 31
32 test('getDefaultForField with invalid tag throws exception', () { 32 test('getDefaultForField with invalid tag throws exception', () {
33 var r = new Rec(); 33 var r = new Rec();
34 expect(() { 34 expect(() {
35 r.getDefaultForField(123); 35 r.getDefaultForField(123);
36 }, throwsError(ArgumentError, "tag 123 not defined in Rec")); 36 }, throwsError(ArgumentError, "tag 123 not defined in Rec"));
37 }); 37 });
38 } 38 }
OLDNEW
« lib/src/protobuf/utils.dart ('K') | « test/map_mixin_test.dart ('k') | test/mock_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698