mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

PR-URL: https://github.com/nodejs/node/pull/26849 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
20 lines
575 B
JavaScript
20 lines
575 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
|
|
// Testing api calls for symbol
|
|
const test_symbol = require(`./build/${common.buildType}/test_symbol`);
|
|
|
|
const sym = test_symbol.New('test');
|
|
assert.strictEqual(sym.toString(), 'Symbol(test)');
|
|
|
|
const myObj = {};
|
|
const fooSym = test_symbol.New('foo');
|
|
const otherSym = test_symbol.New('bar');
|
|
myObj.foo = 'bar';
|
|
myObj[fooSym] = 'baz';
|
|
myObj[otherSym] = 'bing';
|
|
assert.strictEqual(myObj.foo, 'bar');
|
|
assert.strictEqual(myObj[fooSym], 'baz');
|
|
assert.strictEqual(myObj[otherSym], 'bing');
|