From 6539c64e672d624d98e6658db9443491cd4a78fd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 13 Jan 2016 16:14:28 -0800 Subject: [PATCH] test: scope redeclared variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: https://github.com/nodejs/node/pull/4854 Reviewed-By: Colin Ihrig Reviewed-By: Roman Reiss Reviewed-By: targos - Michaƫl Zasso --- test/parallel/test-assert.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index e9c01fda773d9e..d2ce326614f7e4 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -73,9 +73,11 @@ assert.throws(makeBlock(a.deepEqual, /a/i, /a/)); assert.throws(makeBlock(a.deepEqual, /a/m, /a/)); assert.throws(makeBlock(a.deepEqual, /a/igm, /a/im)); -var re1 = /a/; -re1.lastIndex = 3; -assert.throws(makeBlock(a.deepEqual, re1, /a/)); +{ + const re1 = /a/; + re1.lastIndex = 3; + assert.throws(makeBlock(a.deepEqual, re1, /a/)); +} // 7.4 @@ -172,10 +174,11 @@ assert.throws(makeBlock(a.deepStrictEqual, /a/i, /a/)); assert.throws(makeBlock(a.deepStrictEqual, /a/m, /a/)); assert.throws(makeBlock(a.deepStrictEqual, /a/igm, /a/im)); -var re1 = /a/; -re1.lastIndex = 3; -assert.throws(makeBlock(a.deepStrictEqual, re1, /a/)); - +{ + const re1 = /a/; + re1.lastIndex = 3; + assert.throws(makeBlock(a.deepStrictEqual, re1, /a/)); +} // 7.4 - strict assert.throws(makeBlock(a.deepStrictEqual, 4, '4'),