Browse Source

assert: fix actual and expected order

PR-URL: https://github.com/nodejs/node/pull/15866
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
v9.x-staging
Steve Jenkins 8 years ago
committed by Rich Trott
parent
commit
c246716305
  1. 10
      test/parallel/test-vm-run-in-new-context.js

10
test/parallel/test-vm-run-in-new-context.js

@ -33,7 +33,7 @@ common.globalCheck = false;
// Run a string // Run a string
const result = vm.runInNewContext('\'passed\';'); const result = vm.runInNewContext('\'passed\';');
assert.strictEqual('passed', result); assert.strictEqual(result, 'passed');
// Thrown error // Thrown error
assert.throws(() => { assert.throws(() => {
@ -42,7 +42,7 @@ assert.throws(() => {
global.hello = 5; global.hello = 5;
vm.runInNewContext('hello = 2'); vm.runInNewContext('hello = 2');
assert.strictEqual(5, global.hello); assert.strictEqual(global.hello, 5);
// Pass values in and out // Pass values in and out
@ -54,9 +54,9 @@ global.obj = { foo: 0, baz: 3 };
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
const baz = vm.runInNewContext(global.code, global.obj); const baz = vm.runInNewContext(global.code, global.obj);
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
assert.strictEqual(1, global.obj.foo); assert.strictEqual(global.obj.foo, 1);
assert.strictEqual(2, global.obj.bar); assert.strictEqual(global.obj.bar, 2);
assert.strictEqual(2, global.foo); assert.strictEqual(global.foo, 2);
// Call a function by reference // Call a function by reference
function changeFoo() { global.foo = 100; } function changeFoo() { global.foo = 100; }

Loading…
Cancel
Save