-
-
Notifications
You must be signed in to change notification settings - Fork 500
Expand file tree
/
Copy pathfinalizer.js
More file actions
28 lines (23 loc) · 680 Bytes
/
finalizer.js
File metadata and controls
28 lines (23 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
const assert = require('assert');
const testUtil = require('../testUtil');
module.exports = require('../common').runTest(test);
function createWeakRef (binding, bindingToTest) {
return binding.object[bindingToTest]({});
}
function test (binding) {
let obj1;
let obj2;
return testUtil.runGCTests([
'addFinalizer',
() => {
obj1 = createWeakRef(binding, 'addFinalizer');
},
() => assert.deepStrictEqual(obj1, { finalizerCalled: true }),
'addFinalizerWithHint',
() => {
obj2 = createWeakRef(binding, 'addFinalizerWithHint');
},
() => assert.deepStrictEqual(obj2, { finalizerCalledWithCorrectHint: true })
]);
}