mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
Remove string literal message in assert.strictEqual() call in napi test testFinalizer.js. Backport-PR-URL: https://github.com/nodejs/node/pull/22912 PR-URL: https://github.com/nodejs/node/pull/22849 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
|
|
const common = require('../../common');
|
|
const test_general = require(`./build/${common.buildType}/test_general`);
|
|
const assert = require('assert');
|
|
|
|
let finalized = {};
|
|
const callback = common.mustCall(2);
|
|
|
|
// Add two items to be finalized and ensure the callback is called for each.
|
|
test_general.addFinalizerOnly(finalized, callback);
|
|
test_general.addFinalizerOnly(finalized, callback);
|
|
|
|
// Ensure attached items cannot be retrieved.
|
|
common.expectsError(() => test_general.unwrap(finalized),
|
|
{ type: Error, message: 'Invalid argument' });
|
|
|
|
// Ensure attached items cannot be removed.
|
|
common.expectsError(() => test_general.removeWrap(finalized),
|
|
{ type: Error, message: 'Invalid argument' });
|
|
finalized = null;
|
|
global.gc();
|
|
|
|
// Add an item to an object that is already wrapped, and ensure that its
|
|
// finalizer as well as the wrap finalizer gets called.
|
|
let finalizeAndWrap = {};
|
|
test_general.wrap(finalizeAndWrap);
|
|
test_general.addFinalizerOnly(finalizeAndWrap, common.mustCall());
|
|
finalizeAndWrap = null;
|
|
global.gc();
|
|
assert.strictEqual(test_general.derefItemWasCalled(), true);
|