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:
Lee Gray 2018-10-12 10:23:09 -07:00 committed by Ruben Bridgewater
parent d5abbabc4f
commit 495ced01fd
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -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(() => {