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

Unified Diff: test/json_test.dart

Issue 2612233003: Always serialize 64-bit integers as strings in JSON. (Closed)
Patch Set: Add test for JSON-coding of int64s Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/event_test.dart ('k') | test/map_mixin_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/json_test.dart
diff --git a/test/json_test.dart b/test/json_test.dart
index 7accfc05f3d100249866ce04335601e4e4c1d171..7162aeb911b7ea2e7f0d74d07cd69dc0de4a5133 100644
--- a/test/json_test.dart
+++ b/test/json_test.dart
@@ -4,6 +4,7 @@
library json_test;
import 'dart:convert';
+import 'package:fixnum/fixnum.dart' show Int64;
import 'package:test/test.dart';
import 'mock_util.dart' show MockMessage, mockInfo;
@@ -39,6 +40,16 @@ main() {
t.mergeFromJsonMap({"1": 123, "2": "hello"});
checkMessage(t);
});
+
+ test('testInt64JsonEncoding', () {
+ final value = new Int64(1234567890123456789);
+ final t = new T()
+ ..int64 = value;
+ final encoded = t.writeToJsonMap();
+ expect(encoded["5"], "$value");
+ final decoded = new T()..mergeFromJsonMap(encoded);
+ expect(decoded.int64, value);
+ });
}
checkJsonMap(Map m) {
« 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