0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-vm-harmony-symbols.js
Rich Trott 5f44475b5a test: fix redeclared vars in test-vm-*
PR-URL: https://github.com/nodejs/node/pull/4997
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-01 09:39:46 -08:00

17 lines
529 B
JavaScript

'use strict';
require('../common');
var assert = require('assert');
var vm = require('vm');
// The sandbox should have its own Symbol constructor.
var sandbox = {};
vm.runInNewContext('this.Symbol = Symbol', sandbox);
assert(typeof sandbox.Symbol === 'function');
assert(sandbox.Symbol !== Symbol);
// Unless we copy the Symbol constructor explicitly, of course.
sandbox = { Symbol: Symbol };
vm.runInNewContext('this.Symbol = Symbol', sandbox);
assert(typeof sandbox.Symbol === 'function');
assert(sandbox.Symbol === Symbol);