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

Unified Diff: tests/json/json_test.dart

Issue 12192003: Revert "Revert "Revert "Use browsers JSON.parse for parsing JSON.""" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « sdk/lib/json/json_sources.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/json/json_test.dart
diff --git a/tests/json/json_test.dart b/tests/json/json_test.dart
index cdaab0ea7f40b017878e5cd88777c66b2730f05c..5ec1c8386ad70c64b1ac46088a606c2964cbe439 100644
--- a/tests/json/json_test.dart
+++ b/tests/json/json_test.dart
@@ -71,42 +71,6 @@ main() {
equals({"x": {"a":3, "b": -4.5}, "y":[{}],
"z":"hi","w":{"c":null,"d":true}, "v":null}));
- // Errors.
- expect(() => json.parse('True'), throwsFormatException);
- // Unfinished maps.
- expect(() => json.parse('{"a":10)'), throwsFormatException);
- expect(() => json.parse('{"a":}'), throwsFormatException);
- // Insist on double quotes.
- expect(() => json.parse("{'a':1}"), throwsFormatException);
- // Insist on quoted keys.
- expect(() => json.parse('{a:1}'), throwsFormatException);
- });
-
- test('Parse-V8-bugs', () {
- expect(json.parse('{"__proto__": {"x":42}, "y": 37}'),
- equals({"__proto__": {"x":42}, "y": 37}));
-
- expect(json.parse('{"__proto__": []}'),
- equals({"__proto__": []}));
- });
-
- test('Reviver', () {
- reviver(k, v) {
- if (k == '') return [v]; // wrap top level in a list.
- if (v is num || v is String || v is bool || v == null) return '$k$v';
- return v;
- }
-
- go(input, expected) {
- expect(json.parse(input, reviver), equals(expected));
- }
-
- go('null', [null]);
- go('["a", "b", true]', [['0a', '1b', '2true']]);
- go('{"a":100, "b":200}', [{"a":'a100', "b":'b200'}]);
- go('{"a":100, "b":{"c":200}}', [{"a":'a100', "b":{"c":'c200'}}]);
- });
-
test('stringify', () {
// Scalars.
expect(json.stringify(5), equals('5'));
@@ -169,6 +133,7 @@ main() {
* we try to stringify something that cannot be converted to json.
*/
expect(() => json.stringify(new TestClass()), throws);
+ });
});
}
@@ -192,3 +157,5 @@ class ToJson {
validateRoundTrip(expected) {
expect(json.parse(json.stringify(expected)), equals(expected));
}
+
+
« no previous file with comments | « sdk/lib/json/json_sources.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698