Skip to content

Commit

Permalink
test: add tests related to env
Browse files Browse the repository at this point in the history
PR-URL: #1254
Reviewed-By: Michael Dawson <midawson@redhat.com
  • Loading branch information
JckXia authored and mhdawson committed Jan 3, 2023
1 parent 5c39373 commit ad76256
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ static Value Test(const CallbackInfo& info) {
return info.Env().Undefined();
}

static Value ExtractEnvNullValue(const CallbackInfo& info) {
return info.Env().Null();
}

} // namespace

Object InitTypedThreadSafeFunctionPtr(Env env) {
Object exports = Object::New(env);
exports["test"] = Function::New(env, Test);

exports["null"] = Function::New(env, ExtractEnvNullValue);
return exports;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

const assert = require('assert');
module.exports = require('../common').runTest(test);

function test (binding) {
binding.typed_threadsafe_function_ptr.test({}, () => {});
assert(binding.typed_threadsafe_function_ptr.test({}, () => {}) === undefined);
assert(binding.typed_threadsafe_function_ptr.null() === null);
}

0 comments on commit ad76256

Please sign in to comment.