Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit cb55a05

Browse files
author
Julien Gilli
committed
test: add test for let bindings in for loops
0724602 floats a patch on V8 that fixes issue #9113 that would cause let bindings and continue statements in for loops to not work properly. This change adds a regression test that fails if that patch is not properly floated, thus preventing us from not floating that patch after future V8 upgrades. Reviewed-By: Colin Ihrig <[email protected]> PR-URL: #23948
1 parent 2a5f4bd commit cb55a05

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright Joyent, Inc. and other Node contributors.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a
4+
// copy of this software and associated documentation files (the
5+
// "Software"), to deal in the Software without restriction, including
6+
// without limitation the rights to use, copy, modify, merge, publish,
7+
// distribute, sublicense, and/or sell copies of the Software, and to permit
8+
// persons to whom the Software is furnished to do so, subject to the
9+
// following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included
12+
// in all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
22+
/*
23+
* This is a regression test for the issue described at:
24+
* https://github.com/joyent/node/issues/9113.
25+
*
26+
* This problem has been fixed by floating a patch on V8, this test makes
27+
* sure that the appropriate patch is floated even after future V8 upgrades.
28+
*
29+
* If the bug is reproduced, this test stalls and the tests suite makes it
30+
* time out eventually (currently after one minute). Otherwise it exits after
31+
* the for loop completes its execution.
32+
*/
33+
var spawn = require('child_process').spawn;
34+
var args = ['--harmony',
35+
'--use-strict',
36+
'-e',
37+
'for (let i = 0; i < 3; ++i) { if (i == 1) { continue; } }'];
38+
var child = spawn(process.execPath, args);

0 commit comments

Comments
 (0)