mirror of https://github.com/lukechilds/node.git
Browse Source
This commit adds a failing test case for the vm module. Currently, if runInContext() defines a function, and a later call to runInContext() redefines the same function, the original function is not overwritten. Refs: https://github.com/nodejs/node/issues/548 PR-URL: https://github.com/nodejs/node/pull/5528 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>v5.x
cjihrig
9 years ago
committed by
Jeremiah Senkpiel
1 changed files with 11 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||
|
'use strict'; |
||||
|
// Refs: https://github.com/nodejs/node/issues/548
|
||||
|
require('../common'); |
||||
|
const assert = require('assert'); |
||||
|
const vm = require('vm'); |
||||
|
const context = vm.createContext(); |
||||
|
|
||||
|
vm.runInContext('function test() { return 0; }', context); |
||||
|
vm.runInContext('function test() { return 1; }', context); |
||||
|
const result = vm.runInContext('test()', context); |
||||
|
assert.strictEqual(result, 1); |
Loading…
Reference in new issue