mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
612 B
21 lines
612 B
15 years ago
|
require("../common");
|
||
|
|
||
|
var Script = process.binding('evals').Script;
|
||
|
var script = new Script('"passed";');
|
||
|
|
||
|
debug('run in a new empty context');
|
||
|
var context = script.createContext();
|
||
|
var result = script.runInContext(context);
|
||
|
assert.equal('passed', result);
|
||
|
|
||
|
debug('create a new pre-populated context');
|
||
|
context = script.createContext({'foo': 'bar', 'thing': 'lala'});
|
||
|
assert.equal('bar', context.foo);
|
||
|
assert.equal('lala', context.thing);
|
||
|
|
||
|
debug('test updating context');
|
||
|
script = new Script('foo = 3;');
|
||
|
result = script.runInContext(context);
|
||
|
assert.equal(3, context.foo);
|
||
|
assert.equal('lala', context.thing);
|