Skip to content

Commit

Permalink
test: scope redeclared variable
Browse files Browse the repository at this point in the history
`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: #4854
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: targos - Michaël Zasso <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Feb 18, 2016
1 parent c0f5f01 commit 80a637a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 80a637a

Please sign in to comment.