test: fix assertions argument order

PR-URL: https://github.com/nodejs/node/pull/23544
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
KelvinLawHF1 2018-10-12 10:26:11 -07:00 committed by Ruben Bridgewater
parent 5856a59a42
commit 37dfdccbb6
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -26,7 +26,7 @@ const vm = require('vm');
// Run a string
const result = vm.runInThisContext('\'passed\';');
assert.strictEqual('passed', result);
assert.strictEqual(result, 'passed');
// thrown error
assert.throws(function() {
@ -35,7 +35,7 @@ assert.throws(function() {
global.hello = 5;
vm.runInThisContext('hello = 2');
assert.strictEqual(2, global.hello);
assert.strictEqual(global.hello, 2);
// pass values
@ -48,14 +48,14 @@ global.obj = { foo: 0, baz: 3 };
/* eslint-disable no-unused-vars */
const baz = vm.runInThisContext(code);
/* eslint-enable no-unused-vars */
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; };
vm.runInThisContext('f()');
assert.strictEqual(100, global.foo);
assert.strictEqual(global.foo, 100);
common.allowGlobals(
global.hello,