Skip to content
Permalink
Browse files

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>
  • Loading branch information...
addaleax authored and Trott committed Nov 5, 2019
1 parent e460e14 commit 55f4db183f7cf1fdd64b4ab1da138548265e419e
Showing with 22 additions and 71 deletions.
  1. +0 −59 test/addons/at-exit/binding.cc
  2. +0 −9 test/addons/at-exit/binding.gyp
  3. +0 −3 test/addons/at-exit/test.js
  4. +22 −0 test/cctest/test_environment.cc

This file was deleted.

This file was deleted.

This file was deleted.

@@ -12,10 +12,12 @@ static bool called_cb_1 = false;
static bool called_cb_2 = false;
static bool called_cb_ordered_1 = false;
static bool called_cb_ordered_2 = false;
static bool called_at_exit_js = false;
static void at_exit_callback1(void* arg);
static void at_exit_callback2(void* arg);
static void at_exit_callback_ordered1(void* arg);
static void at_exit_callback_ordered2(void* arg);
static void at_exit_js(void* arg);
static std::string cb_1_arg; // NOLINT(runtime/string)

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

TEST_F(EnvironmentTest, AtExitRunsJS) {
const v8::HandleScope handle_scope(isolate_);
const Argv argv;
Env env {handle_scope, argv};

AtExit(*env, at_exit_js, static_cast<void*>(isolate_));
EXPECT_FALSE(called_at_exit_js);
RunAtExit(*env);
EXPECT_TRUE(called_at_exit_js);
}

TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) {
const v8::HandleScope handle_scope(isolate_);
const Argv argv;
@@ -163,3 +176,12 @@ static void at_exit_callback_ordered2(void* arg) {
EXPECT_FALSE(called_cb_ordered_1);
called_cb_ordered_2 = true;
}

static void at_exit_js(void* arg) {
v8::Isolate* isolate = static_cast<v8::Isolate*>(arg);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> obj = v8::Object::New(isolate);
assert(!obj.IsEmpty()); // Assert VM is still alive.
assert(obj->IsObject());
called_at_exit_js = true;
}

0 comments on commit 55f4db1

Please sign in to comment.
You can’t perform that action at this time.