diff options
author | Rich Trott <rtrott@gmail.com> | 2016-01-28 23:02:57 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-01-31 18:06:26 -0800 |
commit | 185f8497e5b7138f2ede5d76e3a25933137cef69 (patch) | |
tree | f4d3b6832da0e67394ee00e6e80dc608a3ed2c3a /test/parallel/test-child-process-validate-stdio.js | |
parent | 1800bf4142e77899df30fd7c673c26e7f7c5dcd1 (diff) | |
download | android-node-v8-185f8497e5b7138f2ede5d76e3a25933137cef69.tar.gz android-node-v8-185f8497e5b7138f2ede5d76e3a25933137cef69.tar.bz2 android-node-v8-185f8497e5b7138f2ede5d76e3a25933137cef69.zip |
test: scope redeclared vars in test-child-process*
A handful of child process tests had variables declared multiple times
in the same scope using `var`. This change scopes those declarations.
PR-URL: https://github.com/nodejs/node/pull/4944
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'test/parallel/test-child-process-validate-stdio.js')
-rw-r--r-- | test/parallel/test-child-process-validate-stdio.js | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 0a12e4f54c..09d0004674 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -2,8 +2,8 @@ // Flags: --expose_internals require('../common'); -var assert = require('assert'); -var _validateStdio = require('internal/child_process')._validateStdio; +const assert = require('assert'); +const _validateStdio = require('internal/child_process')._validateStdio; // should throw if string and not ignore, pipe, or inherit assert.throws(function() { @@ -16,27 +16,31 @@ assert.throws(function() { }, /Incorrect value of stdio option/); // should populate stdio with undefined if len < 3 -var stdio1 = []; -var result = _validateStdio(stdio1, false); -assert.equal(stdio1.length, 3); -assert.equal(result.hasOwnProperty('stdio'), true); -assert.equal(result.hasOwnProperty('ipc'), true); -assert.equal(result.hasOwnProperty('ipcFd'), true); +{ + const stdio1 = []; + const result = _validateStdio(stdio1, false); + assert.equal(stdio1.length, 3); + assert.equal(result.hasOwnProperty('stdio'), true); + assert.equal(result.hasOwnProperty('ipc'), true); + assert.equal(result.hasOwnProperty('ipcFd'), true); +} // should throw if stdio has ipc and sync is true -var stdio2 = ['ipc', 'ipc', 'ipc']; +const stdio2 = ['ipc', 'ipc', 'ipc']; assert.throws(function() { _validateStdio(stdio2, true); }, /You cannot use IPC with synchronous forks/); -const stdio3 = [process.stdin, process.stdout, process.stderr]; -var result = _validateStdio(stdio3, false); -assert.deepStrictEqual(result, { - stdio: [ - { type: 'fd', fd: 0 }, - { type: 'fd', fd: 1 }, - { type: 'fd', fd: 2 } - ], - ipc: undefined, - ipcFd: undefined -}); +{ + const stdio3 = [process.stdin, process.stdout, process.stderr]; + const result = _validateStdio(stdio3, false); + assert.deepStrictEqual(result, { + stdio: [ + { type: 'fd', fd: 0 }, + { type: 'fd', fd: 1 }, + { type: 'fd', fd: 2 } + ], + ipc: undefined, + ipcFd: undefined + }); +} |