GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: remove AtExit() addon test · nodejs/node@de719fc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • addons/at-exit
      • binding.cc
      • binding.gyp
      • test.js
    • cctest
      • test_environment.cc
Expand file treeCollapse file tree
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.