mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
Signed-off-by: ishabi <ilyasshabi94@gmail.com> PR-URL: https://github.com/nodejs/node/pull/64801 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
24 lines
762 B
JavaScript
24 lines
762 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
|
|
const { buildEmbedderGraph } = internalBinding('heap_utils');
|
|
|
|
const first = {};
|
|
const second = {};
|
|
const bigint = BigInt('123456789012345678901234567890');
|
|
const sameBigint = BigInt('123456789012345678901234567890');
|
|
const graph = buildEmbedderGraph(first, first, second, bigint, sameBigint);
|
|
|
|
function findNodes(value) {
|
|
return graph.filter((node) => Object.hasOwn(node, 'value') &&
|
|
Object.is(node.value, value));
|
|
}
|
|
|
|
assert.strictEqual(findNodes(first).length, 1);
|
|
assert.strictEqual(findNodes(second).length, 1);
|
|
assert.strictEqual(findNodes(bigint).length, 1);
|