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

Side by Side Diff: test/json_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 | « test/event_test.dart ('k') | test/map_mixin_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 // Basic smoke tests for the GeneratedMessage JSON API. 1 // Basic smoke tests for the GeneratedMessage JSON API.
2 // 2 //
3 // There are more JSON tests in the dart-protoc-plugin package. 3 // There are more JSON tests in the dart-protoc-plugin package.
4 library json_test; 4 library json_test;
5 5
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
8 8
9 import 'mock_util.dart' show MockMessage; 9 import 'mock_util.dart' show MockMessage, mockInfo;
10 10
11 class T extends MockMessage { 11 class T extends MockMessage {
12 get className => "T"; 12 get info_ => _info;
13 T create() => new T(); 13 static final _info = mockInfo("T", () => new T());
14 } 14 }
15 15
16 main() { 16 main() {
17 T example = new T() 17 T example = new T()
18 ..val = 123 18 ..val = 123
19 ..str = "hello"; 19 ..str = "hello";
20 20
21 test('testWriteToJson', () { 21 test('testWriteToJson', () {
22 String json = example.writeToJson(); 22 String json = example.writeToJson();
23 checkJsonMap(JSON.decode(json)); 23 checkJsonMap(JSON.decode(json));
(...skipping 20 matching lines...) Expand all
44 checkJsonMap(Map m) { 44 checkJsonMap(Map m) {
45 expect(m.length, 2); 45 expect(m.length, 2);
46 expect(m["1"], 123); 46 expect(m["1"], 123);
47 expect(m["2"], "hello"); 47 expect(m["2"], "hello");
48 } 48 }
49 49
50 checkMessage(T t) { 50 checkMessage(T t) {
51 expect(t.val, 123); 51 expect(t.val, 123);
52 expect(t.str, "hello"); 52 expect(t.str, "hello");
53 } 53 }
OLDNEW
« no previous file with comments | « test/event_test.dart ('k') | test/map_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698