From 6de80fcaea7f7026ae1fc84314afafaf62530a8b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 20 Jun 2016 10:46:38 +0200 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig --- test/addons/buffer-free-callback/binding.cc | 5 +++-- test/addons/buffer-free-callback/binding.gyp | 5 +---- test/addons/make-callback-recurse/binding.cc | 6 +++--- test/addons/make-callback-recurse/binding.gyp | 5 +---- test/addons/make-callback/binding.cc | 9 ++++----- test/addons/make-callback/binding.gyp | 5 +---- test/addons/null-buffer-neuter/binding.cc | 9 +++++---- test/addons/null-buffer-neuter/binding.gyp | 5 +---- 8 files changed, 19 insertions(+), 30 deletions(-) diff --git a/test/addons/buffer-free-callback/binding.cc b/test/addons/buffer-free-callback/binding.cc index 7bfd5e061d8b0c..a72386fdd627ab 100644 --- a/test/addons/buffer-free-callback/binding.cc +++ b/test/addons/buffer-free-callback/binding.cc @@ -1,8 +1,9 @@ #include #include -#include #include +#include + static int alive; static char buf[1024]; @@ -32,7 +33,7 @@ void Check(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); isolate->RequestGarbageCollectionForTesting( v8::Isolate::kFullGarbageCollection); - CHECK_GT(alive, 0); + assert(alive > 0); } void init(v8::Local target) { diff --git a/test/addons/buffer-free-callback/binding.gyp b/test/addons/buffer-free-callback/binding.gyp index 50d094746c474e..7ede63d94a0d77 100644 --- a/test/addons/buffer-free-callback/binding.gyp +++ b/test/addons/buffer-free-callback/binding.gyp @@ -2,10 +2,7 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'V8_DEPRECATION_WARNINGS=1', - ], + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/make-callback-recurse/binding.cc b/test/addons/make-callback-recurse/binding.cc index 1195dbe2ff7e4c..3e3a1464930477 100644 --- a/test/addons/make-callback-recurse/binding.cc +++ b/test/addons/make-callback-recurse/binding.cc @@ -1,7 +1,7 @@ #include "node.h" #include "v8.h" -#include "../../../src/util.h" +#include using v8::Function; using v8::FunctionCallbackInfo; @@ -13,8 +13,8 @@ using v8::Value; namespace { void MakeCallback(const FunctionCallbackInfo& args) { - CHECK(args[0]->IsObject()); - CHECK(args[1]->IsFunction()); + assert(args[0]->IsObject()); + assert(args[1]->IsFunction()); Isolate* isolate = args.GetIsolate(); Local recv = args[0].As(); Local method = args[1].As(); diff --git a/test/addons/make-callback-recurse/binding.gyp b/test/addons/make-callback-recurse/binding.gyp index 50d094746c474e..7ede63d94a0d77 100644 --- a/test/addons/make-callback-recurse/binding.gyp +++ b/test/addons/make-callback-recurse/binding.gyp @@ -2,10 +2,7 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'V8_DEPRECATION_WARNINGS=1', - ], + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/make-callback/binding.cc b/test/addons/make-callback/binding.cc index a1adb997bbf9b9..8970e9fb1af76c 100644 --- a/test/addons/make-callback/binding.cc +++ b/test/addons/make-callback/binding.cc @@ -1,15 +1,14 @@ #include "node.h" #include "v8.h" -#include "../../../src/util.h" - +#include #include namespace { void MakeCallback(const v8::FunctionCallbackInfo& 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(); std::vector> argv; @@ -26,7 +25,7 @@ void MakeCallback(const v8::FunctionCallbackInfo& args) { result = node::MakeCallback(isolate, recv, method, argv.size(), argv.data()); } else { - UNREACHABLE(); + assert(0 && "unreachable"); } args.GetReturnValue().Set(result); } diff --git a/test/addons/make-callback/binding.gyp b/test/addons/make-callback/binding.gyp index 50d094746c474e..7ede63d94a0d77 100644 --- a/test/addons/make-callback/binding.gyp +++ b/test/addons/make-callback/binding.gyp @@ -2,10 +2,7 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'V8_DEPRECATION_WARNINGS=1', - ], + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/null-buffer-neuter/binding.cc b/test/addons/null-buffer-neuter/binding.cc index da75919011f58b..532e22883383dd 100644 --- a/test/addons/null-buffer-neuter/binding.cc +++ b/test/addons/null-buffer-neuter/binding.cc @@ -1,12 +1,13 @@ #include #include -#include #include +#include + static int alive; static void FreeCallback(char* data, void* hint) { - CHECK_EQ(data, nullptr); + assert(data == nullptr); alive--; } @@ -24,13 +25,13 @@ void Run(const v8::FunctionCallbackInfo& args) { nullptr).ToLocalChecked(); char* data = node::Buffer::Data(buf); - CHECK_EQ(data, nullptr); + assert(data == nullptr); } isolate->RequestGarbageCollectionForTesting( v8::Isolate::kFullGarbageCollection); - CHECK_EQ(alive, 0); + assert(alive == 0); } void init(v8::Local target) { diff --git a/test/addons/null-buffer-neuter/binding.gyp b/test/addons/null-buffer-neuter/binding.gyp index 50d094746c474e..7ede63d94a0d77 100644 --- a/test/addons/null-buffer-neuter/binding.gyp +++ b/test/addons/null-buffer-neuter/binding.gyp @@ -2,10 +2,7 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'V8_DEPRECATION_WARNINGS=1', - ], + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ] } ]