Skip to content

Commit f325c95

Browse files
committed
test: re-enable cctest that was commented out
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>
1 parent 4a6748d commit f325c95

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

test/cctest/test_environment.cc

+21-18
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,27 @@ class EnvironmentTest : public EnvironmentTestFixture {
3232
}
3333
};
3434

35-
// TODO(codebytere): re-enable this test.
36-
// TEST_F(EnvironmentTest, PreExeuctionPreparation) {
37-
// const v8::HandleScope handle_scope(isolate_);
38-
// const Argv argv;
39-
// Env env {handle_scope, argv};
40-
41-
// v8::Local<v8::Context> context = isolate_->GetCurrentContext();
42-
43-
// const char* run_script = "process.argv0";
44-
// v8::Local<v8::Script> script = v8::Script::Compile(
45-
// context,
46-
// v8::String::NewFromOneByte(isolate_,
47-
// reinterpret_cast<const uint8_t*>(run_script),
48-
// v8::NewStringType::kNormal).ToLocalChecked())
49-
// .ToLocalChecked();
50-
// v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
51-
// CHECK(result->IsString());
52-
// }
35+
TEST_F(EnvironmentTest, PreExecutionPreparation) {
36+
const v8::HandleScope handle_scope(isolate_);
37+
const Argv argv;
38+
Env env {handle_scope, argv};
39+
40+
node::LoadEnvironment(*env, [&](const node::StartExecutionCallbackInfo& info)
41+
-> v8::MaybeLocal<v8::Value> {
42+
return v8::Null(isolate_);
43+
});
44+
45+
v8::Local<v8::Context> context = isolate_->GetCurrentContext();
46+
const char* run_script = "process.argv0";
47+
v8::Local<v8::Script> script = v8::Script::Compile(
48+
context,
49+
v8::String::NewFromOneByte(isolate_,
50+
reinterpret_cast<const uint8_t*>(run_script),
51+
v8::NewStringType::kNormal).ToLocalChecked())
52+
.ToLocalChecked();
53+
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
54+
CHECK(result->IsString());
55+
}
5356

5457
TEST_F(EnvironmentTest, LoadEnvironmentWithCallback) {
5558
const v8::HandleScope handle_scope(isolate_);

0 commit comments

Comments
 (0)