Skip to content

Conversation

@mhdawson
Copy link
Member

We had some, but not complete coverage indirectly through
other tests. Add test to validate it specifically and
covers cases that were not being covered.

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, n-api

We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered.
@nodejs-github-botnodejs-github-bot added node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests. labels Jun 29, 2017
@mhdawsonmhdawson requested a review from jasonginJune 30, 2017 13:39
assert.strictEqual(test_general.testGetVersion(),1);

[123,'test string',function(){},newObject(),true,
undefined,Symbol()].forEach((val)=>{
Copy link
Member

Choose a reason for hiding this comment

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

Small readability nit

[123,'test string',function(){},newObject(),true,undefined,Symbol()].forEach( ... )


napi_valueresult;
if (object_type==napi_number){
NAPI_CALL(env ,napi_create_number(env, 42, &result));
Copy link
Contributor

Choose a reason for hiding this comment

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

The comma after env is misaligned.

napi_valueargs[1];
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));

napi_valuetypeobject_type;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think something like argument_type would be more descriptive of what this variable is.


[123,'test string',function(){},newObject(),true,
undefined,Symbol()].forEach((val)=>{
assert.strictEqual(typeofval,typeof(test_general.testNapiTypeof(val)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this test is specifically for napi_typeof(), I don't understand why test_general.testNapiTypeof() returns a value of that type instead of just a string representing the type. Then, this assertion could be:

assert.strictEqual(typeof val, test_general.testNapiTypeof(val));

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That would probably work as well. Just not what I can up with. I'll take a look as its probably an easy change.

@mhdawson
Copy link
MemberAuthor

Pushed commit to address comments.

napi_valueresult;
NAPI_CALL(env, napi_get_version(env, &version));
NAPI_CALL(env,napi_create_number(env, version, &result));
NAPI_CALL(env,napi_create_number(env, version, &result));
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a space after the first comma.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

undefined,
Symbol()
].forEach((val)=>{
assert.strictEqual(typeofval,test_general.testNapiTypeof(val));
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh. A tiny nit here and on line 52. I think the parameter order should be switched to reflect actual, expected

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks for catching that will update.

@mhdawson
Copy link
MemberAuthor

Pushed commit to address final comments

CI run: https://ci.nodejs.org/job/node-test-pull-request/8994/

@mhdawson
Copy link
MemberAuthor

Landed as 34cf8ad

@mhdawsonmhdawson closed this Jul 5, 2017
mhdawson added a commit that referenced this pull request Jul 5, 2017
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. PR-URL: #13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@Trott
Copy link
Member

Trott commented Jul 6, 2017

This test is failing consistently for me locally on macOS.

@Trott
Copy link
Member

Trott commented Jul 6, 2017

Running make test-addons-napi-clean fixed my issue. So, uh, yeah, never mind. Sorry for the noise.

addaleax pushed a commit that referenced this pull request Jul 11, 2017
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. PR-URL: #13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@addaleaxaddaleax mentioned this pull request Jul 11, 2017
addaleax pushed a commit that referenced this pull request Jul 18, 2017
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. PR-URL: #13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Jul 19, 2017
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. PR-URL: #13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. PR-URL: nodejs#13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. Backport-PR-URL: #19447 PR-URL: #13990 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Apr 16, 2018
@mhdawsonmhdawson deleted the napi-cov30 branch September 30, 2019 13:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

node-apiIssues and PRs related to the Node-API.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mhdawson@Trott@jasnell@cjihrig@MylesBorins@nodejs-github-bot