Skip to content

Commit

Permalink
test: re-enable cctest that was commented out
Browse files Browse the repository at this point in the history
Refs: #31910

Backport-PR-URL: #35241
PR-URL: #30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
addaleax committed Sep 23, 2020
1 parent 4a6748d commit f325c95
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ class EnvironmentTest : public EnvironmentTestFixture {
}
};

// TODO(codebytere): re-enable this test.
// TEST_F(EnvironmentTest, PreExeuctionPreparation) {
// const v8::HandleScope handle_scope(isolate_);
// const Argv argv;
// Env env {handle_scope, argv};

// v8::Local<v8::Context> context = isolate_->GetCurrentContext();

// const char* run_script = "process.argv0";
// v8::Local<v8::Script> script = v8::Script::Compile(
// context,
// v8::String::NewFromOneByte(isolate_,
// reinterpret_cast<const uint8_t*>(run_script),
// v8::NewStringType::kNormal).ToLocalChecked())
// .ToLocalChecked();
// v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
// CHECK(result->IsString());
// }
TEST_F(EnvironmentTest, PreExecutionPreparation) {
const v8::HandleScope handle_scope(isolate_);
const Argv argv;
Env env {handle_scope, argv};

node::LoadEnvironment(*env, [&](const node::StartExecutionCallbackInfo& info)
-> v8::MaybeLocal<v8::Value> {
return v8::Null(isolate_);
});

v8::Local<v8::Context> context = isolate_->GetCurrentContext();
const char* run_script = "process.argv0";
v8::Local<v8::Script> script = v8::Script::Compile(
context,
v8::String::NewFromOneByte(isolate_,
reinterpret_cast<const uint8_t*>(run_script),
v8::NewStringType::kNormal).ToLocalChecked())
.ToLocalChecked();
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
CHECK(result->IsString());
}

TEST_F(EnvironmentTest, LoadEnvironmentWithCallback) {
const v8::HandleScope handle_scope(isolate_);
Expand Down

0 comments on commit f325c95

Please sign in to comment.