Skip to content

Commit adccf30

Browse files
committed
test: remove AtExit() addon test
Move the one bit of the addon test that was not covered by the cctest into the latter and delete the former. Refs: nodejs#30227 (comment)
1 parent 5b2067c commit adccf30

4 files changed

Lines changed: 18 additions & 71 deletions

File tree

test/addons/at-exit/binding.cc

Lines changed: 0 additions & 59 deletions
This file was deleted.

test/addons/at-exit/binding.gyp

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/addons/at-exit/test.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/cctest/test_environment.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static void at_exit_callback1(void* arg);
1616
static void at_exit_callback2(void* arg);
1717
static void at_exit_callback_ordered1(void* arg);
1818
static void at_exit_callback_ordered2(void* arg);
19+
static void at_exit_js(void* arg);
1920
static std::string cb_1_arg; // NOLINT(runtime/string)
2021

2122
class EnvironmentTest : public EnvironmentTestFixture {
@@ -91,6 +92,15 @@ TEST_F(EnvironmentTest, AtExitWithArgument) {
9192
EXPECT_EQ(arg, cb_1_arg);
9293
}
9394

95+
TEST_F(EnvironmentTest, AtExitRunsJS) {
96+
const v8::HandleScope handle_scope(isolate_);
97+
const Argv argv;
98+
Env env {handle_scope, argv};
99+
100+
AtExit(*env, at_exit_js, static_cast<void*>(isolate_));
101+
RunAtExit(*env);
102+
}
103+
94104
TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) {
95105
const v8::HandleScope handle_scope(isolate_);
96106
const Argv argv;
@@ -163,3 +173,11 @@ static void at_exit_callback_ordered2(void* arg) {
163173
EXPECT_FALSE(called_cb_ordered_1);
164174
called_cb_ordered_2 = true;
165175
}
176+
177+
static void at_exit_js(void* arg) {
178+
v8::Isolate* isolate = static_cast<v8::Isolate*>(arg);
179+
v8::HandleScope handle_scope(isolate);
180+
v8::Local<v8::Object> obj = v8::Object::New(isolate);
181+
assert(!obj.IsEmpty()); // Assert VM is still alive.
182+
assert(obj->IsObject());
183+
}

0 commit comments

Comments
 (0)