Skip to content

Commit

Permalink
test: fix order of assert arguments in vm-new-script-this-context
Browse files Browse the repository at this point in the history
Fixes the order of assert.strictEqual arguments.

PR-URL: #23558
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Victor Poriazov authored and jasnell committed Oct 17, 2018
1 parent 2f38550 commit 4118e90
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-vm-new-script-this-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Script = require('vm').Script;
// Run a string
let script = new Script('\'passed\';');
const result = script.runInThisContext(script);
assert.strictEqual('passed', result);
assert.strictEqual(result, 'passed');

// Thrown error
script = new Script('throw new Error(\'test\');');
Expand All @@ -38,7 +38,7 @@ assert.throws(() => {
global.hello = 5;
script = new Script('hello = 2');
script.runInThisContext(script);
assert.strictEqual(2, global.hello);
assert.strictEqual(global.hello, 2);


// Pass values
Expand All @@ -49,15 +49,15 @@ global.foo = 2;
global.obj = { foo: 0, baz: 3 };
script = new Script(global.code);
script.runInThisContext(script);
assert.strictEqual(0, global.obj.foo);
assert.strictEqual(2, global.bar);
assert.strictEqual(1, global.foo);
assert.strictEqual(global.obj.foo, 0);
assert.strictEqual(global.bar, 2);
assert.strictEqual(global.foo, 1);

// Call a function
global.f = function() { global.foo = 100; };
script = new Script('f()');
script.runInThisContext(script);
assert.strictEqual(100, global.foo);
assert.strictEqual(global.foo, 100);

common.allowGlobals(
global.hello,
Expand Down

0 comments on commit 4118e90

Please sign in to comment.