Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de719fc

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
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: #30227 (comment) PR-URL: #30275 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 3117ea6 commit de719fc
Copy full SHA for de719fc

File tree

Expand file treeCollapse file tree

4 files changed

+22
-71
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+22
-71
lines changed
Open diff view settings
Collapse file

‎test/addons/at-exit/binding.cc‎

Copy file name to clipboardExpand all lines: test/addons/at-exit/binding.cc
-59Lines changed: 0 additions & 59 deletions
This file was deleted.
Collapse file

‎test/addons/at-exit/binding.gyp‎

Copy file name to clipboardExpand all lines: test/addons/at-exit/binding.gyp
-9Lines changed: 0 additions & 9 deletions
This file was deleted.
Collapse file

‎test/addons/at-exit/test.js‎

Copy file name to clipboardExpand all lines: test/addons/at-exit/test.js
-3Lines changed: 0 additions & 3 deletions
This file was deleted.
Collapse file

‎test/cctest/test_environment.cc‎

Copy file name to clipboardExpand all lines: test/cctest/test_environment.cc
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ static bool called_cb_1 = false;
1212
static bool called_cb_2 = false;
1313
static bool called_cb_ordered_1 = false;
1414
static bool called_cb_ordered_2 = false;
15+
static bool called_at_exit_js = false;
1516
static void at_exit_callback1(void* arg);
1617
static void at_exit_callback2(void* arg);
1718
static void at_exit_callback_ordered1(void* arg);
1819
static void at_exit_callback_ordered2(void* arg);
20+
static void at_exit_js(void* arg);
1921
static std::string cb_1_arg; // NOLINT(runtime/string)
2022

2123
class EnvironmentTest : public EnvironmentTestFixture {
@@ -91,6 +93,17 @@ TEST_F(EnvironmentTest, AtExitWithArgument) {
9193
EXPECT_EQ(arg, cb_1_arg);
9294
}
9395

96+
TEST_F(EnvironmentTest, AtExitRunsJS) {
97+
const v8::HandleScope handle_scope(isolate_);
98+
const Argv argv;
99+
Env env {handle_scope, argv};
100+
101+
AtExit(*env, at_exit_js, static_cast<void*>(isolate_));
102+
EXPECT_FALSE(called_at_exit_js);
103+
RunAtExit(*env);
104+
EXPECT_TRUE(called_at_exit_js);
105+
}
106+
94107
TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) {
95108
const v8::HandleScope handle_scope(isolate_);
96109
const Argv argv;
@@ -163,3 +176,12 @@ static void at_exit_callback_ordered2(void* arg) {
163176
EXPECT_FALSE(called_cb_ordered_1);
164177
called_cb_ordered_2 = true;
165178
}
179+
180+
static void at_exit_js(void* arg) {
181+
v8::Isolate* isolate = static_cast<v8::Isolate*>(arg);
182+
v8::HandleScope handle_scope(isolate);
183+
v8::Local<v8::Object> obj = v8::Object::New(isolate);
184+
assert(!obj.IsEmpty()); // Assert VM is still alive.
185+
assert(obj->IsObject());
186+
called_at_exit_js = true;
187+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.