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

Unified Diff: test/cctest/test-api.cc

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 | « src/string-builder.h ('k') | test/mjsunit/es6/proxies-json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 5db8321db414e78a8f9eb8687511cd22c2103247..4f40ef46296556903a711ac6733800d3a0e5cc4e 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -22048,6 +22048,20 @@ THREADED_TEST(JSONStringifyObject) {
ExpectString("JSON.stringify(obj)", *utf8);
}
+THREADED_TEST(JSONStringifyObjectWithGap) {
+ LocalContext context;
+ HandleScope scope(context->GetIsolate());
+ Local<Value> value =
+ v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked();
+ Local<Object> obj = value->ToObject(context.local()).ToLocalChecked();
+ Local<Object> global = context->Global();
+ global->Set(context.local(), v8_str("obj"), obj).FromJust();
+ Local<String> json =
+ v8::JSON::Stringify(context.local(), obj, v8_str("*")).ToLocalChecked();
+ v8::String::Utf8Value utf8(json);
+ ExpectString("JSON.stringify(obj, null, '*')", *utf8);
+}
+
#if V8_OS_POSIX && !V8_OS_NACL
class ThreadInterruptTest {
public:
« no previous file with comments | « src/string-builder.h ('k') | test/mjsunit/es6/proxies-json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698