mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 14:26:57 +00:00

The convention for js-native-api/<test_name>: * <test_name>.c or <test_name>.cc has the entry point * The name of the target is <test_name> PR-URL: https://github.com/nodejs/node/pull/38692 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
21 lines
558 B
JavaScript
21 lines
558 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const addon = require(`./build/${common.buildType}/8_passing_wrapped`);
|
|
|
|
async function runTest() {
|
|
let obj1 = addon.createObject(10);
|
|
let obj2 = addon.createObject(20);
|
|
const result = addon.add(obj1, obj2);
|
|
assert.strictEqual(result, 30);
|
|
|
|
// Make sure the native destructor gets called.
|
|
obj1 = null;
|
|
obj2 = null;
|
|
await common.gcUntil('8_passing_wrapped',
|
|
() => (addon.finalizeCount() === 2));
|
|
}
|
|
runTest();
|