Sha256: 0e09e94aa149f1c26eebf185459f3163eeb0e5e051b3c47f96620ab59726504b

Contents?: true

Size: 511 Bytes

Versions: 8

Compression:

Stored size: 511 Bytes

Contents

var test = require('testling');
var vm = require('./');

test('vmRunInNewContext', function (t) {
    t.plan(5);
    
    t.equal(vm.runInNewContext('a + 5', { a : 100 }), 105);
    
    (function () {
        var vars = { x : 10 };
        t.equal(vm.runInNewContext('x++', vars), 10);
        t.equal(vars.x, 11);
    })();
    
    (function () {
        var vars = { x : 10 };
        t.equal(vm.runInNewContext('var y = 3; y + x++', vars), 13);
        t.equal(vars.x, 11);
    })();
    
    t.end();
});

Version data entries

8 entries across 6 versions & 3 rubygems

Version Path
snowball-0.1.22 node_modules/browserify/node_modules/vm-browserify/testling/run.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js
sprockets-browserify-0.1.2 node_modules/browserify/node_modules/vm-browserify/testling/run.js
sprockets-browserify-0.1.2 node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js
sprockets-browserify-0.1.0 node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js
sprockets-browserify-0.1.0 node_modules/browserify/node_modules/vm-browserify/testling/run.js