mirror of
https://github.com/nodejs/node.git
synced 2025-08-17 14:48:58 +02: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>
26 lines
784 B
JavaScript
26 lines
784 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const test = require(`./build/${common.buildType}/7_factory_wrap`);
|
|
|
|
assert.strictEqual(test.finalizeCount, 0);
|
|
async function runGCTests() {
|
|
(() => {
|
|
const obj = test.createObject(10);
|
|
assert.strictEqual(obj.plusOne(), 11);
|
|
assert.strictEqual(obj.plusOne(), 12);
|
|
assert.strictEqual(obj.plusOne(), 13);
|
|
})();
|
|
await common.gcUntil('test 1', () => (test.finalizeCount === 1));
|
|
|
|
(() => {
|
|
const obj2 = test.createObject(20);
|
|
assert.strictEqual(obj2.plusOne(), 21);
|
|
assert.strictEqual(obj2.plusOne(), 22);
|
|
assert.strictEqual(obj2.plusOne(), 23);
|
|
})();
|
|
await common.gcUntil('test 2', () => (test.finalizeCount === 2));
|
|
}
|
|
runGCTests();
|