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: #371
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@NickNaso.local>
  • Loading branch information
nadongguri authored and mhdawson committed Oct 22, 2018
1 parent 67b7db0 commit 2342415
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 2342415

Please sign in to comment.