| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index ca2c8dea063c4fca55ad398b7e1c8897f15900b6..f17859e2e47b9d0a02bd71b0345077528fd80255 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -24347,6 +24347,26 @@ TEST(PromiseThen) {
|
| .FromJust());
|
| }
|
|
|
| +TEST(PromiseStatusAndValue) {
|
| + LocalContext context;
|
| + v8::Isolate* isolate = context->GetIsolate();
|
| + v8::HandleScope scope(isolate);
|
| + v8::Local<v8::Value> result = CompileRun(
|
| + "var resolver;"
|
| + "new Promise((res, rej) => { resolver = res; })");
|
| + v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(result);
|
| + CHECK_EQ(v8::Promise::kPending, promise->Status());
|
| + CHECK(promise->Result().IsEmpty());
|
| +
|
| + CompileRun("resolver('fulfilled')");
|
| + CHECK_EQ(v8::Promise::kFulfilled, promise->Status());
|
| + CHECK(v8_str("fulfilled")->SameValue(promise->Result().ToLocalChecked()));
|
| +
|
| + result = CompileRun("Promise.reject('rejected')");
|
| + promise = v8::Local<v8::Promise>::Cast(result);
|
| + CHECK_EQ(v8::Promise::kRejected, promise->Status());
|
| + CHECK(v8_str("rejected")->SameValue(promise->Result().ToLocalChecked()));
|
| +}
|
|
|
| TEST(DisallowJavascriptExecutionScope) {
|
| LocalContext context;
|
|
|