Skip to content

Commit ad76256

Browse files
JckXiamhdawson
authored andcommitted
test: add tests related to env
PR-URL: #1254 Reviewed-By: Michael Dawson <[email protected]
1 parent 5c39373 commit ad76256

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

test/typed_threadsafe_function/typed_threadsafe_function_ptr.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ static Value Test(const CallbackInfo& info) {
1616
return info.Env().Undefined();
1717
}
1818

19+
static Value ExtractEnvNullValue(const CallbackInfo& info) {
20+
return info.Env().Null();
21+
}
22+
1923
} // namespace
2024

2125
Object InitTypedThreadSafeFunctionPtr(Env env) {
2226
Object exports = Object::New(env);
2327
exports["test"] = Function::New(env, Test);
24-
28+
exports["null"] = Function::New(env, ExtractEnvNullValue);
2529
return exports;
2630
}
2731

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
2-
2+
const assert = require('assert');
33
module.exports = require('../common').runTest(test);
44

55
function test (binding) {
6-
binding.typed_threadsafe_function_ptr.test({}, () => {});
6+
assert(binding.typed_threadsafe_function_ptr.test({}, () => {}) === undefined);
7+
assert(binding.typed_threadsafe_function_ptr.null() === null);
78
}

0 commit comments

Comments
 (0)