Adding unit tests for FunctionReference class#1035
Adding unit tests for FunctionReference class#1035JckXia wants to merge 6 commits intonodejs:mainfrom
Conversation
|
@nodejs/node-api anybody else want to take a look before I land this? |
| let hook; | ||
| const events = [] | ||
| return new Promise((res, reject) =>{ | ||
| console.log('Installing async hook') |
4986dce to
c0396b3
Compare
| 'error.cc', | ||
| 'external.cc', | ||
| 'function.cc', | ||
| 'funcRefObject.cc', |
There was a problem hiding this comment.
Please make sure the file names and the name of the init function are consistent for #1078 by @deepakrkris!
There was a problem hiding this comment.
@deepakrkris this is interesting, because it creates a situation where a test file has a dependency. Maybe this class definition should go to the top of function_reference.cc instead because that's the only file using it. Then we can also avoid having to deal with file dependencies.
| int _value; | ||
| }; | ||
|
|
||
| #endif No newline at end of file |
| Napi::FunctionReference ref; | ||
| ref.Reset(info[0].As<Function>()); | ||
|
|
||
| Napi::AsyncContext contxt(info.Env(), "func_ref_resources", {}); |
| args[argIdx] = info[i]; | ||
| } | ||
|
|
||
| Napi::AsyncContext contxt(info.Env(), "func_ref_resources", {}); |
|
|
||
| return exports; | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Please add a newline!
| binding.AsyncCallWithArgv(testFuncB, 2, 4, 5, 6) === testFuncB(2, 4, 5, 6) | ||
| ); | ||
| } | ||
| function test (binding) { |
There was a problem hiding this comment.
This should be async because it should await canCallAsyncFunctionWithDifferentOverloads.
There was a problem hiding this comment.
... and it should itself be awaited at the call site.
c0396b3 to
5eb3c5e
Compare
PR-URL: #1035 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
|
Landed as 04b26a9 |
PR-URL: nodejs/node-addon-api#1035 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
PR-URL: nodejs/node-addon-api#1035 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
PR-URL: nodejs/node-addon-api#1035 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
PR-URL: nodejs/node-addon-api#1035 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Adding test coverage for FunctionReference class. #989