mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
7534477786
PR-URL: https://github.com/nodejs/node/pull/32542 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
37 lines
852 B
JavaScript
37 lines
852 B
JavaScript
'use strict';
|
|
// Flags: --expose-internals
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const fixtures = require('../common/fixtures');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
|
|
const {
|
|
getHiddenValue,
|
|
setHiddenValue,
|
|
arrow_message_private_symbol: kArrowMessagePrivateSymbolIndex
|
|
} = internalBinding('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));
|