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:
parent
5856a59a42
commit
37dfdccbb6
@ -26,7 +26,7 @@ const vm = require('vm');
|
|||||||
|
|
||||||
// Run a string
|
// Run a string
|
||||||
const result = vm.runInThisContext('\'passed\';');
|
const result = vm.runInThisContext('\'passed\';');
|
||||||
assert.strictEqual('passed', result);
|
assert.strictEqual(result, 'passed');
|
||||||
|
|
||||||
// thrown error
|
// thrown error
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
@ -35,7 +35,7 @@ assert.throws(function() {
|
|||||||
|
|
||||||
global.hello = 5;
|
global.hello = 5;
|
||||||
vm.runInThisContext('hello = 2');
|
vm.runInThisContext('hello = 2');
|
||||||
assert.strictEqual(2, global.hello);
|
assert.strictEqual(global.hello, 2);
|
||||||
|
|
||||||
|
|
||||||
// pass values
|
// pass values
|
||||||
@ -48,14 +48,14 @@ global.obj = { foo: 0, baz: 3 };
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
const baz = vm.runInThisContext(code);
|
const baz = vm.runInThisContext(code);
|
||||||
/* eslint-enable no-unused-vars */
|
/* eslint-enable no-unused-vars */
|
||||||
assert.strictEqual(0, global.obj.foo);
|
assert.strictEqual(global.obj.foo, 0);
|
||||||
assert.strictEqual(2, global.bar);
|
assert.strictEqual(global.bar, 2);
|
||||||
assert.strictEqual(1, global.foo);
|
assert.strictEqual(global.foo, 1);
|
||||||
|
|
||||||
// call a function
|
// call a function
|
||||||
global.f = function() { global.foo = 100; };
|
global.f = function() { global.foo = 100; };
|
||||||
vm.runInThisContext('f()');
|
vm.runInThisContext('f()');
|
||||||
assert.strictEqual(100, global.foo);
|
assert.strictEqual(global.foo, 100);
|
||||||
|
|
||||||
common.allowGlobals(
|
common.allowGlobals(
|
||||||
global.hello,
|
global.hello,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user