test: fix assert order in test-vm-context
PR-URL: https://github.com/nodejs/node/pull/23523 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
d5abbabc4f
commit
495ced01fd
@ -30,18 +30,18 @@ let script = new Script('"passed";');
|
||||
// Run in a new empty context
|
||||
let context = vm.createContext();
|
||||
let result = script.runInContext(context);
|
||||
assert.strictEqual('passed', result);
|
||||
assert.strictEqual(result, 'passed');
|
||||
|
||||
// Create a new pre-populated context
|
||||
context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' });
|
||||
assert.strictEqual('bar', context.foo);
|
||||
assert.strictEqual('lala', context.thing);
|
||||
assert.strictEqual(context.foo, 'bar');
|
||||
assert.strictEqual(context.thing, 'lala');
|
||||
|
||||
// Test updating context
|
||||
script = new Script('foo = 3;');
|
||||
result = script.runInContext(context);
|
||||
assert.strictEqual(3, context.foo);
|
||||
assert.strictEqual('lala', context.thing);
|
||||
assert.strictEqual(context.foo, 3);
|
||||
assert.strictEqual(context.thing, 'lala');
|
||||
|
||||
// Issue GH-227:
|
||||
common.expectsError(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user