Skip to content

Commit 6de80fc

Browse files
bnoordhuisFishrock123
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 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent c7ab7a3 commit 6de80fc

File tree

8 files changed

+19
-30
lines changed

8 files changed

+19
-30
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

@@ -32,7 +33,7 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) {
3233
v8::Isolate* isolate = args.GetIsolate();
3334
isolate->RequestGarbageCollectionForTesting(
3435
v8::Isolate::kFullGarbageCollection);
35-
CHECK_GT(alive, 0);
36+
assert(alive > 0);
3637
}
3738

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

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
'targets': [
33
{
44
'target_name': 'binding',
5-
'defines': [
6-
'NODE_WANT_INTERNALS=1',
7-
'V8_DEPRECATION_WARNINGS=1',
8-
],
5+
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
96
'sources': [ 'binding.cc' ]
107
}
118
]

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-recurse/binding.gyp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
'targets': [
33
{
44
'target_name': 'binding',
5-
'defines': [
6-
'NODE_WANT_INTERNALS=1',
7-
'V8_DEPRECATION_WARNINGS=1',
8-
],
5+
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
96
'sources': [ 'binding.cc' ]
107
}
118
]

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
}

test/addons/make-callback/binding.gyp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
'targets': [
33
{
44
'target_name': 'binding',
5-
'defines': [
6-
'NODE_WANT_INTERNALS=1',
7-
'V8_DEPRECATION_WARNINGS=1',
8-
],
5+
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
96
'sources': [ 'binding.cc' ]
107
}
118
]

test/addons/null-buffer-neuter/binding.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
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

89
static void FreeCallback(char* data, void* hint) {
9-
CHECK_EQ(data, nullptr);
10+
assert(data == nullptr);
1011
alive--;
1112
}
1213

@@ -24,13 +25,13 @@ void Run(const v8::FunctionCallbackInfo<v8::Value>& args) {
2425
nullptr).ToLocalChecked();
2526

2627
char* data = node::Buffer::Data(buf);
27-
CHECK_EQ(data, nullptr);
28+
assert(data == nullptr);
2829
}
2930

3031
isolate->RequestGarbageCollectionForTesting(
3132
v8::Isolate::kFullGarbageCollection);
3233

33-
CHECK_EQ(alive, 0);
34+
assert(alive == 0);
3435
}
3536

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

test/addons/null-buffer-neuter/binding.gyp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
'targets': [
33
{
44
'target_name': 'binding',
5-
'defines': [
6-
'NODE_WANT_INTERNALS=1',
7-
'V8_DEPRECATION_WARNINGS=1',
8-
],
5+
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
96
'sources': [ 'binding.cc' ]
107
}
118
]

0 commit comments

Comments
 (0)