Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test: add coverage for napi_typeof#13990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
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.
| assert.strictEqual(test_general.testGetVersion(),1); | ||
| [123,'test string',function(){},newObject(),true, | ||
| undefined,Symbol()].forEach((val)=>{ |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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));
There was a problem hiding this comment.
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 commented Jun 30, 2017
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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 commented Jul 5, 2017
Pushed commit to address final comments CI run: https://ci.nodejs.org/job/node-test-pull-request/8994/ |
mhdawson commented Jul 5, 2017
Landed as 34cf8ad |
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 commented Jul 6, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
This test is failing consistently for me locally on macOS. |
Trott commented Jul 6, 2017
Running |
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]>
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]>
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]>
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]>
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]>
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), orvcbuild test(Windows) passesAffected core subsystem(s)
test, n-api