blob: a648777fdcf974ee9d136d0fdc634111c63bbeaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
var common = require('../common');
var assert = require('assert');
var vm = require('vm');
assert.throws(function() {
vm.runInDebugContext('*');
}, /SyntaxError/);
assert.throws(function() {
vm.runInDebugContext({ toString: assert.fail });
}, /AssertionError/);
assert.throws(function() {
vm.runInDebugContext('throw URIError("BAM")');
}, /URIError/);
assert.throws(function() {
vm.runInDebugContext('(function(f) { f(f) })(function(f) { f(f) })');
}, /RangeError/);
assert.equal(typeof(vm.runInDebugContext('this')), 'object');
assert.equal(typeof(vm.runInDebugContext('Debug')), 'object');
assert.strictEqual(vm.runInDebugContext(), undefined);
assert.strictEqual(vm.runInDebugContext(0), 0);
assert.strictEqual(vm.runInDebugContext(null), null);
assert.strictEqual(vm.runInDebugContext(undefined), undefined);
|