summaryrefslogtreecommitdiff
path: root/test/cctest
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-20 00:12:23 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-03 08:46:03 +0800
commit19442656789a7edd327d453a16f699d4f5259a5c (patch)
tree78ae15e1b70df80d14b7306aea25d9d90973b7fe /test/cctest
parente02f511dccaf41f103403936359d43ce2ad86d1e (diff)
downloadandroid-node-v8-19442656789a7edd327d453a16f699d4f5259a5c.tar.gz
android-node-v8-19442656789a7edd327d453a16f699d4f5259a5c.tar.bz2
android-node-v8-19442656789a7edd327d453a16f699d4f5259a5c.zip
process: run RunBootstrapping in CreateEnvironment
Also creates `CreateMainEnvironment` to encapsulate the code creating the main environment from the provided Isolate data and arguments. PR-URL: https://github.com/nodejs/node/pull/26788 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/cctest')
-rw-r--r--test/cctest/node_test_fixture.h2
-rw-r--r--test/cctest/test_environment.cc18
2 files changed, 18 insertions, 2 deletions
diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h
index 0359ec3c76..a6b704d13f 100644
--- a/test/cctest/node_test_fixture.h
+++ b/test/cctest/node_test_fixture.h
@@ -131,8 +131,6 @@ class EnvironmentTestFixture : public NodeTestFixture {
1, *argv,
argv.nr_args(), *argv);
CHECK_NE(nullptr, environment_);
- // TODO(addaleax): Make this a public API.
- CHECK(!RunBootstrapping(environment_).IsEmpty());
}
~Env() {
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
index aba4b71947..1ec4ae2100 100644
--- a/test/cctest/test_environment.cc
+++ b/test/cctest/test_environment.cc
@@ -23,6 +23,24 @@ class EnvironmentTest : public EnvironmentTestFixture {
}
};
+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, AtExitWithEnvironment) {
const v8::HandleScope handle_scope(isolate_);
const Argv argv;