mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 12:49:23 +00:00

These are internal only utility functions, CHECK instead of throw PR-URL: https://github.com/nodejs/node/pull/16544 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
36 lines
790 B
JavaScript
36 lines
790 B
JavaScript
'use strict';
|
|
// Flags: --expose_internals
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const {
|
|
getHiddenValue,
|
|
setHiddenValue,
|
|
arrow_message_private_symbol: kArrowMessagePrivateSymbolIndex
|
|
} = process.binding('util');
|
|
|
|
assert.strictEqual(
|
|
getHiddenValue({}, kArrowMessagePrivateSymbolIndex),
|
|
undefined);
|
|
|
|
const obj = {};
|
|
assert.strictEqual(
|
|
setHiddenValue(obj, kArrowMessagePrivateSymbolIndex, 'bar'),
|
|
true);
|
|
assert.strictEqual(
|
|
getHiddenValue(obj, kArrowMessagePrivateSymbolIndex),
|
|
'bar');
|
|
|
|
let arrowMessage;
|
|
|
|
try {
|
|
require(fixtures.path('syntax', 'bad_syntax'));
|
|
} catch (err) {
|
|
arrowMessage =
|
|
getHiddenValue(err, kArrowMessagePrivateSymbolIndex);
|
|
}
|
|
|
|
assert(/bad_syntax\.js:1/.test(arrowMessage));
|