1 var nodeunit = require('../lib/nodeunit');
2 var sandbox = require('../lib/utils').sandbox;
3 var testCase = nodeunit.testCase;
5 exports.testSimpleSandbox = function (test) {
6 var raw_jscode1 = sandbox(__dirname + '/fixtures/raw_jscode1.js');
7 test.equal(raw_jscode1.hello_world('foo'), '_foo_', 'evaluation ok');
11 exports.testSandboxContext = function (test) {
12 var a_variable = 42; // should not be visible in the sandbox
13 var raw_jscode2 = sandbox(__dirname + '/fixtures/raw_jscode2.js');
14 a_variable = 42; // again for the win
16 raw_jscode2.get_a_variable(),
18 'the variable should not be defined'
23 exports.testSandboxMultiple = function (test) {
24 var raw_jscode3 = sandbox([
25 __dirname + '/fixtures/raw_jscode3.js',
26 __dirname + '/fixtures/raw_jscode3.js',
27 __dirname + '/fixtures/raw_jscode3.js'
29 test.equal(raw_jscode3.t, 3, 'two files loaded');