Skip to content

Commit

Permalink
test: create test objects in the stack instead of the heap
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node-addon-api#371
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Hitesh Kanwathirtha <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
  • Loading branch information
John French committed Oct 22, 2018
1 parent fa5e345 commit f3fb1da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/basic_types/boolean.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Value CreateEmptyBoolean(const CallbackInfo& info) {
}

Value CreateBooleanFromExistingValue(const CallbackInfo& info) {
Boolean* boolean = new Boolean(info.Env(), info[0].As<Boolean>());
return Boolean::New(info.Env(), boolean->Value());
Boolean boolean(info.Env(), info[0].As<Boolean>());
return Boolean::New(info.Env(), boolean.Value());
}

Value CreateBooleanFromPrimitive(const CallbackInfo& info) {
Expand Down
4 changes: 2 additions & 2 deletions test/basic_types/number.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ Value OperatorDouble(const CallbackInfo& info) {
}

Value CreateEmptyNumber(const CallbackInfo& info) {
Number* number = new Number();
return Boolean::New(info.Env(), number->IsEmpty());
Number number;
return Boolean::New(info.Env(), number.IsEmpty());
}

Value CreateNumberFromExistingValue(const CallbackInfo& info) {
Expand Down

0 comments on commit f3fb1da

Please sign in to comment.