Skip to content

Commit 361aa01

Browse files
bnoordhuisMylesBorins
authored andcommitted
test: don't use internal headers in add-on tests
There is no real need and it causes endless grief on Windows with some of the upcoming changes. PR-URL: #6734 Backport-PR-URL: #16550 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent fadf854 commit 361aa01

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

test/addons/buffer-free-callback/binding.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include <node.h>
22
#include <node_buffer.h>
3-
#include <util.h>
43
#include <v8.h>
54

5+
#include <assert.h>
6+
67
static int alive;
78
static char buf[1024];
89

@@ -25,7 +26,7 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) {
2526
v8::Isolate* isolate = args.GetIsolate();
2627
isolate->RequestGarbageCollectionForTesting(
2728
v8::Isolate::kFullGarbageCollection);
28-
CHECK_GT(alive, 0);
29+
assert(alive > 0);
2930
}
3031

3132
void init(v8::Local<v8::Object> target) {

test/addons/make-callback-recurse/binding.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "node.h"
22
#include "v8.h"
33

4-
#include "../../../src/util.h"
4+
#include <assert.h>
55

66
using v8::Function;
77
using v8::FunctionCallbackInfo;
@@ -13,8 +13,8 @@ using v8::Value;
1313
namespace {
1414

1515
void MakeCallback(const FunctionCallbackInfo<Value>& args) {
16-
CHECK(args[0]->IsObject());
17-
CHECK(args[1]->IsFunction());
16+
assert(args[0]->IsObject());
17+
assert(args[1]->IsFunction());
1818
Isolate* isolate = args.GetIsolate();
1919
Local<Object> recv = args[0].As<Object>();
2020
Local<Function> method = args[1].As<Function>();

test/addons/make-callback/binding.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include "node.h"
22
#include "v8.h"
33

4-
#include "../../../src/util.h"
5-
4+
#include <assert.h>
65
#include <vector>
76

87
namespace {
98

109
void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
11-
CHECK(args[0]->IsObject());
12-
CHECK(args[1]->IsFunction() || args[1]->IsString());
10+
assert(args[0]->IsObject());
11+
assert(args[1]->IsFunction() || args[1]->IsString());
1312
auto isolate = args.GetIsolate();
1413
auto recv = args[0].As<v8::Object>();
1514
std::vector<v8::Local<v8::Value>> argv;
@@ -26,7 +25,7 @@ void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
2625
result =
2726
node::MakeCallback(isolate, recv, method, argv.size(), argv.data());
2827
} else {
29-
UNREACHABLE();
28+
assert(0 && "unreachable");
3029
}
3130
args.GetReturnValue().Set(result);
3231
}

0 commit comments

Comments
 (0)