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: https://github.com/nodejs/node/pull/6734 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
0672fca921
commit
3c85f4e237
@ -1,8 +1,9 @@
|
|||||||
#include <node.h>
|
#include <node.h>
|
||||||
#include <node_buffer.h>
|
#include <node_buffer.h>
|
||||||
#include <util.h>
|
|
||||||
#include <v8.h>
|
#include <v8.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
static int alive;
|
static int alive;
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||||||
v8::Isolate* isolate = args.GetIsolate();
|
v8::Isolate* isolate = args.GetIsolate();
|
||||||
isolate->RequestGarbageCollectionForTesting(
|
isolate->RequestGarbageCollectionForTesting(
|
||||||
v8::Isolate::kFullGarbageCollection);
|
v8::Isolate::kFullGarbageCollection);
|
||||||
CHECK_GT(alive, 0);
|
assert(alive > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(v8::Local<v8::Object> target) {
|
void init(v8::Local<v8::Object> target) {
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
'targets': [
|
'targets': [
|
||||||
{
|
{
|
||||||
'target_name': 'binding',
|
'target_name': 'binding',
|
||||||
'defines': [
|
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
|
||||||
'NODE_WANT_INTERNALS=1',
|
|
||||||
'V8_DEPRECATION_WARNINGS=1',
|
|
||||||
],
|
|
||||||
'sources': [ 'binding.cc' ]
|
'sources': [ 'binding.cc' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "v8.h"
|
#include "v8.h"
|
||||||
|
|
||||||
#include "../../../src/util.h"
|
#include <assert.h>
|
||||||
|
|
||||||
using v8::Function;
|
using v8::Function;
|
||||||
using v8::FunctionCallbackInfo;
|
using v8::FunctionCallbackInfo;
|
||||||
@ -13,8 +13,8 @@ using v8::Value;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void MakeCallback(const FunctionCallbackInfo<Value>& args) {
|
void MakeCallback(const FunctionCallbackInfo<Value>& args) {
|
||||||
CHECK(args[0]->IsObject());
|
assert(args[0]->IsObject());
|
||||||
CHECK(args[1]->IsFunction());
|
assert(args[1]->IsFunction());
|
||||||
Isolate* isolate = args.GetIsolate();
|
Isolate* isolate = args.GetIsolate();
|
||||||
Local<Object> recv = args[0].As<Object>();
|
Local<Object> recv = args[0].As<Object>();
|
||||||
Local<Function> method = args[1].As<Function>();
|
Local<Function> method = args[1].As<Function>();
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
'targets': [
|
'targets': [
|
||||||
{
|
{
|
||||||
'target_name': 'binding',
|
'target_name': 'binding',
|
||||||
'defines': [
|
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
|
||||||
'NODE_WANT_INTERNALS=1',
|
|
||||||
'V8_DEPRECATION_WARNINGS=1',
|
|
||||||
],
|
|
||||||
'sources': [ 'binding.cc' ]
|
'sources': [ 'binding.cc' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "v8.h"
|
#include "v8.h"
|
||||||
|
|
||||||
#include "../../../src/util.h"
|
#include <assert.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||||
CHECK(args[0]->IsObject());
|
assert(args[0]->IsObject());
|
||||||
CHECK(args[1]->IsFunction() || args[1]->IsString());
|
assert(args[1]->IsFunction() || args[1]->IsString());
|
||||||
auto isolate = args.GetIsolate();
|
auto isolate = args.GetIsolate();
|
||||||
auto recv = args[0].As<v8::Object>();
|
auto recv = args[0].As<v8::Object>();
|
||||||
std::vector<v8::Local<v8::Value>> argv;
|
std::vector<v8::Local<v8::Value>> argv;
|
||||||
@ -26,7 +25,7 @@ void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||||||
result =
|
result =
|
||||||
node::MakeCallback(isolate, recv, method, argv.size(), argv.data());
|
node::MakeCallback(isolate, recv, method, argv.size(), argv.data());
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
assert(0 && "unreachable");
|
||||||
}
|
}
|
||||||
args.GetReturnValue().Set(result);
|
args.GetReturnValue().Set(result);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
'targets': [
|
'targets': [
|
||||||
{
|
{
|
||||||
'target_name': 'binding',
|
'target_name': 'binding',
|
||||||
'defines': [
|
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
|
||||||
'NODE_WANT_INTERNALS=1',
|
|
||||||
'V8_DEPRECATION_WARNINGS=1',
|
|
||||||
],
|
|
||||||
'sources': [ 'binding.cc' ]
|
'sources': [ 'binding.cc' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include <node.h>
|
#include <node.h>
|
||||||
#include <node_buffer.h>
|
#include <node_buffer.h>
|
||||||
#include <util.h>
|
|
||||||
#include <v8.h>
|
#include <v8.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
static int alive;
|
static int alive;
|
||||||
|
|
||||||
static void FreeCallback(char* data, void* hint) {
|
static void FreeCallback(char* data, void* hint) {
|
||||||
CHECK_EQ(data, nullptr);
|
assert(data == nullptr);
|
||||||
alive--;
|
alive--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,13 +25,13 @@ void Run(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||||||
nullptr).ToLocalChecked();
|
nullptr).ToLocalChecked();
|
||||||
|
|
||||||
char* data = node::Buffer::Data(buf);
|
char* data = node::Buffer::Data(buf);
|
||||||
CHECK_EQ(data, nullptr);
|
assert(data == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
isolate->RequestGarbageCollectionForTesting(
|
isolate->RequestGarbageCollectionForTesting(
|
||||||
v8::Isolate::kFullGarbageCollection);
|
v8::Isolate::kFullGarbageCollection);
|
||||||
|
|
||||||
CHECK_EQ(alive, 0);
|
assert(alive == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(v8::Local<v8::Object> target) {
|
void init(v8::Local<v8::Object> target) {
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
'targets': [
|
'targets': [
|
||||||
{
|
{
|
||||||
'target_name': 'binding',
|
'target_name': 'binding',
|
||||||
'defines': [
|
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
|
||||||
'NODE_WANT_INTERNALS=1',
|
|
||||||
'V8_DEPRECATION_WARNINGS=1',
|
|
||||||
],
|
|
||||||
'sources': [ 'binding.cc' ]
|
'sources': [ 'binding.cc' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user