Browse Source

test: rename target to exports for consistency

The doc/api/addons.md document contains examples of Addon
Initialization functions that take a parameter named exports.
This also matches the name used in node.cc when calling:
mp->nm_register_func(exports, module, mp->nm_priv);

Currently, a number of the tests name this same parameter target. This
commit renames target to exports for consistency.

PR-URL: https://github.com/nodejs/node/pull/9135
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v6
Daniel Bevenius 8 years ago
parent
commit
09d41e22cc
  1. 4
      test/addons/at-exit/binding.cc
  2. 6
      test/addons/buffer-free-callback/binding.cc
  3. 4
      test/addons/hello-world/binding.cc
  4. 4
      test/addons/load-long-path/binding.cc
  5. 4
      test/addons/make-callback-recurse/binding.cc
  6. 4
      test/addons/make-callback/binding.cc
  7. 4
      test/addons/null-buffer-neuter/binding.cc
  8. 4
      test/addons/parse-encoding/binding.cc
  9. 4
      test/addons/repl-domain-abort/binding.cc
  10. 4
      test/addons/stringbytes-external-exceed-max/binding.cc
  11. 4
      test/addons/symlinked-module/binding.cc

4
test/addons/at-exit/binding.cc

@ -33,8 +33,8 @@ static void sanity_check(void) {
assert(at_exit_cb2_called == 2); assert(at_exit_cb2_called == 2);
} }
void init(Local<Object> target) { void init(Local<Object> exports) {
AtExit(at_exit_cb1, target->CreationContext()->GetIsolate()); AtExit(at_exit_cb1, exports->GetIsolate());
AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie);
AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie);
atexit(sanity_check); atexit(sanity_check);

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

@ -36,9 +36,9 @@ void Check(const v8::FunctionCallbackInfo<v8::Value>& args) {
assert(alive > 0); assert(alive > 0);
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "alloc", Alloc); NODE_SET_METHOD(exports, "alloc", Alloc);
NODE_SET_METHOD(target, "check", Check); NODE_SET_METHOD(exports, "check", Check);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

4
test/addons/hello-world/binding.cc

@ -7,8 +7,8 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "hello", Method); NODE_SET_METHOD(exports, "hello", Method);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

4
test/addons/load-long-path/binding.cc

@ -6,8 +6,8 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "hello", Method); NODE_SET_METHOD(exports, "hello", Method);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

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

@ -22,8 +22,8 @@ void MakeCallback(const FunctionCallbackInfo<Value>& args) {
node::MakeCallback(isolate, recv, method, 0, nullptr); node::MakeCallback(isolate, recv, method, 0, nullptr);
} }
void Initialize(Local<Object> target) { void Initialize(Local<Object> exports) {
NODE_SET_METHOD(target, "makeCallback", MakeCallback); NODE_SET_METHOD(exports, "makeCallback", MakeCallback);
} }
} // namespace } // namespace

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

@ -30,8 +30,8 @@ void MakeCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(result); args.GetReturnValue().Set(result);
} }
void Initialize(v8::Local<v8::Object> target) { void Initialize(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "makeCallback", MakeCallback); NODE_SET_METHOD(exports, "makeCallback", MakeCallback);
} }
} // namespace } // namespace

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

@ -34,8 +34,8 @@ void Run(const v8::FunctionCallbackInfo<v8::Value>& args) {
assert(alive == 0); assert(alive == 0);
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "run", Run); NODE_SET_METHOD(exports, "run", Run);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

4
test/addons/parse-encoding/binding.cc

@ -29,8 +29,8 @@ void ParseEncoding(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(encoding_string); args.GetReturnValue().Set(encoding_string);
} }
void Initialize(v8::Local<v8::Object> target) { void Initialize(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "parseEncoding", ParseEncoding); NODE_SET_METHOD(exports, "parseEncoding", ParseEncoding);
} }
} // anonymous namespace } // anonymous namespace

4
test/addons/repl-domain-abort/binding.cc

@ -19,8 +19,8 @@ void Method(const FunctionCallbackInfo<Value>& args) {
NULL); NULL);
} }
void init(Local<Object> target) { void init(Local<Object> exports) {
NODE_SET_METHOD(target, "method", Method); NODE_SET_METHOD(exports, "method", Method);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

4
test/addons/stringbytes-external-exceed-max/binding.cc

@ -17,8 +17,8 @@ void EnsureAllocation(const v8::FunctionCallbackInfo<v8::Value> &args) {
args.GetReturnValue().Set(success); args.GetReturnValue().Set(success);
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "ensureAllocation", EnsureAllocation); NODE_SET_METHOD(exports, "ensureAllocation", EnsureAllocation);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

4
test/addons/symlinked-module/binding.cc

@ -6,8 +6,8 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
} }
void init(v8::Local<v8::Object> target) { void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(target, "hello", Method); NODE_SET_METHOD(exports, "hello", Method);
} }
NODE_MODULE(binding, init); NODE_MODULE(binding, init);

Loading…
Cancel
Save