Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.x backport] Use external headers in addons tests #16550

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/addons/buffer-free-callback/binding.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include <node.h>
#include <node_buffer.h>
#include <util.h>
#include <v8.h>

#include <assert.h>

static int alive;
static char buf[1024];

Expand All @@ -25,7 +26,7 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
isolate->RequestGarbageCollectionForTesting(
v8::Isolate::kFullGarbageCollection);
CHECK_GT(alive, 0);
assert(alive > 0);
}

void init(v8::Local<v8::Object> target) {
Expand Down
6 changes: 3 additions & 3 deletions test/addons/make-callback-recurse/binding.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "node.h"
#include "v8.h"

#include "../../../src/util.h"
#include <assert.h>

using v8::Function;
using v8::FunctionCallbackInfo;
Expand All @@ -13,8 +13,8 @@ using v8::Value;
namespace {

void MakeCallback(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsObject());
CHECK(args[1]->IsFunction());
assert(args[0]->IsObject());
assert(args[1]->IsFunction());
Isolate* isolate = args.GetIsolate();
Local<Object> recv = args[0].As<Object>();
Local<Function> method = args[1].As<Function>();
Expand Down
9 changes: 4 additions & 5 deletions test/addons/make-callback/binding.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#include "node.h"
#include "v8.h"

#include "../../../src/util.h"

#include <assert.h>
#include <vector>

namespace {

void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(args[0]->IsObject());
CHECK(args[1]->IsFunction() || args[1]->IsString());
assert(args[0]->IsObject());
assert(args[1]->IsFunction() || args[1]->IsString());
auto isolate = args.GetIsolate();
auto recv = args[0].As<v8::Object>();
std::vector<v8::Local<v8::Value>> argv;
Expand All @@ -26,7 +25,7 @@ void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
result =
node::MakeCallback(isolate, recv, method, argv.size(), argv.data());
} else {
UNREACHABLE();
assert(0 && "unreachable");
}
args.GetReturnValue().Set(result);
}
Expand Down