summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-create-context-arg.js
blob: 65dcf05e2b2bf3f33d83eb060b28da6b15714cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var common = require('../common');
var assert = require('assert');
var vm = require('vm');

assert.throws(function() {
  var ctx = vm.createContext('string is not supported');
}, TypeError);

assert.doesNotThrow(function() {
  var ctx = vm.createContext({ a: 1 });
  ctx = vm.createContext([0, 1, 2, 3]);
});

assert.doesNotThrow(function() {
    var sandbox = {};
    vm.createContext(sandbox);
    vm.createContext(sandbox);
});