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

Unified Diff: test/mjsunit/json2.js

Issue 1922603006: [JSON] implement indentation in the BasicJsonStringifier and expose via API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 7 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/mjsunit/json.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/json2.js
diff --git a/test/mjsunit/json2.js b/test/mjsunit/json2.js
index f68c76c92ad563540f9ba8c7ec1e7ef468375fdd..75e25f89242414ebc976cb768d750b7b604d53e1 100644
--- a/test/mjsunit/json2.js
+++ b/test/mjsunit/json2.js
@@ -35,7 +35,9 @@ assertTrue(JSON.stringify(this, null, 0).indexOf('"a":12345') > 0);
// Test JSON.stringify of array in dictionary mode.
function TestStringify(expected, input) {
assertEquals(expected, JSON.stringify(input));
- assertEquals(expected, JSON.stringify(input, null, 0));
+ assertEquals(expected, JSON.stringify(input, (key, value) => value));
+ assertEquals(JSON.stringify(input, null, "="),
+ JSON.stringify(input, (key, value) => value, "="));
}
var array_1 = [];
@@ -76,7 +78,7 @@ var getter_obj = { get getter() {
return 123;
} };
TestStringify('{"getter":123}', getter_obj);
-assertEquals(2, counter);
+assertEquals(4, counter);
// Test toJSON function.
var tojson_obj = { toJSON: function() {
@@ -85,7 +87,7 @@ var tojson_obj = { toJSON: function() {
},
a: 1};
TestStringify('[1,2]', tojson_obj);
-assertEquals(4, counter);
+assertEquals(8, counter);
// Test that we don't recursively look for the toJSON function.
var tojson_proto_obj = { a: 'fail' };
« no previous file with comments | « test/mjsunit/json.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698