Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

test: add a new.target test to addons-napi #452

Merged
merged 2 commits into from
Jan 17, 2018

Conversation

boingoing
Copy link
Contributor

N-API testing for new.target is lacking. Rectify this.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@boingoing
Copy link
Contributor Author

This needs to have #451 merged before CI will pass.


// this !== new.target since we are being invoked through super()
bool result;
NAPI_CALL(env, napi_strict_equals(env, newTargetArg, thisArg, &result));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth also having an additional test where new.target === this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it probably is. That would be a regular (non-super) construction case. I'll add one.

Copy link
Contributor

@digitalinfinity digitalinfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@boingoing
Copy link
Contributor Author

boingoing commented Jan 17, 2018

@jackhorton
Copy link
Contributor

Any reason why we wouldnt make this test upstream?

@boingoing
Copy link
Contributor Author

@jackhorton We should take this one upstream. I split it into a separate commit so it would be easier.

@boingoing boingoing merged commit 985faa1 into nodejs:master Jan 17, 2018
kfarnung pushed a commit that referenced this pull request Jan 17, 2018
N-API testing for new.target is lacking. Rectify this.
@kfarnung kfarnung mentioned this pull request Apr 24, 2018
4 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants