GeezerVison is showing github.com — test: don't use internal headers in add-on tests · nodejs/node@6de80fc
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/addons/buffer-free-callback/binding.cc +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include <node.h> | 2 | 2 | #include <node_buffer.h> | 3 | | -#include <util.h> | 4 | 3 | #include <v8.h> | 5 | 4 |
| | 5 | +#include <assert.h> | | 6 | + | 6 | 7 | static int alive; | 7 | 8 | static char buf[1024]; | 8 | 9 |
| @@ -32,7 +33,7 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) { | 32 | 33 | v8::Isolate* isolate = args.GetIsolate(); | 33 | 34 | isolate->RequestGarbageCollectionForTesting( | 34 | 35 | v8::Isolate::kFullGarbageCollection); | 35 | | - CHECK_GT(alive, 0); | | 36 | + assert(alive > 0); | 36 | 37 | } | 37 | 38 |
| 38 | 39 | void init(v8::Local<v8::Object> target) { | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/buffer-free-callback/binding.gyp +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | 'targets': [ | 3 | 3 | { | 4 | 4 | 'target_name': 'binding', | 5 | | - 'defines': [ | 6 | | - 'NODE_WANT_INTERNALS=1', | 7 | | - 'V8_DEPRECATION_WARNINGS=1', | 8 | | - ], | | 5 | + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], | 9 | 6 | 'sources': [ 'binding.cc' ] | 10 | 7 | } | 11 | 8 | ] | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback-recurse/binding.cc +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "node.h" | 2 | 2 | #include "v8.h" | 3 | 3 |
| 4 | | -#include "../../../src/util.h" | | 4 | +#include <assert.h> | 5 | 5 |
| 6 | 6 | using v8::Function; | 7 | 7 | using v8::FunctionCallbackInfo; | @@ -13,8 +13,8 @@ using v8::Value; | 13 | 13 | namespace { | 14 | 14 |
| 15 | 15 | 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()); | 18 | 18 | Isolate* isolate = args.GetIsolate(); | 19 | 19 | Local<Object> recv = args[0].As<Object>(); | 20 | 20 | Local<Function> method = args[1].As<Function>(); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback-recurse/binding.gyp +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | 'targets': [ | 3 | 3 | { | 4 | 4 | 'target_name': 'binding', | 5 | | - 'defines': [ | 6 | | - 'NODE_WANT_INTERNALS=1', | 7 | | - 'V8_DEPRECATION_WARNINGS=1', | 8 | | - ], | | 5 | + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], | 9 | 6 | 'sources': [ 'binding.cc' ] | 10 | 7 | } | 11 | 8 | ] | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback/binding.cc +4-5Lines changed: 4 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "node.h" | 2 | 2 | #include "v8.h" | 3 | 3 |
| 4 | | -#include "../../../src/util.h" | 5 | | - | | 4 | +#include <assert.h> | 6 | 5 | #include <vector> | 7 | 6 |
| 8 | 7 | namespace { | 9 | 8 |
| 10 | 9 | 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()); | 13 | 12 | auto isolate = args.GetIsolate(); | 14 | 13 | auto recv = args[0].As<v8::Object>(); | 15 | 14 | std::vector<v8::Local<v8::Value>> argv; | @@ -26,7 +25,7 @@ void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { | 26 | 25 | result = | 27 | 26 | node::MakeCallback(isolate, recv, method, argv.size(), argv.data()); | 28 | 27 | } else { | 29 | | - UNREACHABLE(); | | 28 | + assert(0 && "unreachable"); | 30 | 29 | } | 31 | 30 | args.GetReturnValue().Set(result); | 32 | 31 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback/binding.gyp +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | 'targets': [ | 3 | 3 | { | 4 | 4 | 'target_name': 'binding', | 5 | | - 'defines': [ | 6 | | - 'NODE_WANT_INTERNALS=1', | 7 | | - 'V8_DEPRECATION_WARNINGS=1', | 8 | | - ], | | 5 | + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], | 9 | 6 | 'sources': [ 'binding.cc' ] | 10 | 7 | } | 11 | 8 | ] | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/null-buffer-neuter/binding.cc +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include <node.h> | 2 | 2 | #include <node_buffer.h> | 3 | | -#include <util.h> | 4 | 3 | #include <v8.h> | 5 | 4 |
| | 5 | +#include <assert.h> | | 6 | + | 6 | 7 | static int alive; | 7 | 8 |
| 8 | 9 | static void FreeCallback(char* data, void* hint) { | 9 | | - CHECK_EQ(data, nullptr); | | 10 | + assert(data == nullptr); | 10 | 11 | alive--; | 11 | 12 | } | 12 | 13 |
| @@ -24,13 +25,13 @@ void Run(const v8::FunctionCallbackInfo<v8::Value>& args) { | 24 | 25 | nullptr).ToLocalChecked(); | 25 | 26 |
| 26 | 27 | char* data = node::Buffer::Data(buf); | 27 | | - CHECK_EQ(data, nullptr); | | 28 | + assert(data == nullptr); | 28 | 29 | } | 29 | 30 |
| 30 | 31 | isolate->RequestGarbageCollectionForTesting( | 31 | 32 | v8::Isolate::kFullGarbageCollection); | 32 | 33 |
| 33 | | - CHECK_EQ(alive, 0); | | 34 | + assert(alive == 0); | 34 | 35 | } | 35 | 36 |
| 36 | 37 | void init(v8::Local<v8::Object> target) { | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/null-buffer-neuter/binding.gyp +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | 'targets': [ | 3 | 3 | { | 4 | 4 | 'target_name': 'binding', | 5 | | - 'defines': [ | 6 | | - 'NODE_WANT_INTERNALS=1', | 7 | | - 'V8_DEPRECATION_WARNINGS=1', | 8 | | - ], | | 5 | + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], | 9 | 6 | 'sources': [ 'binding.cc' ] | 10 | 7 | } | 11 | 8 | ] | |
|