mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 09:07:45 +00:00

PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
14 lines
307 B
JavaScript
14 lines
307 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vm = require('vm');
|
|
|
|
var sandbox = { x: 3 };
|
|
|
|
var ctx = vm.createContext(sandbox);
|
|
|
|
assert.strictEqual(vm.runInContext('x;', ctx), 3);
|
|
vm.runInContext('y = 4;', ctx);
|
|
assert.strictEqual(sandbox.y, 4);
|
|
assert.strictEqual(ctx.y, 4);
|