summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-07 19:01:30 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-07 19:01:30 +0200
commit9d3776d0d45ca437ddb7f9079ae0367102abc90f (patch)
tree34fc3e27f0d065d51ea5d329c4c29d79b55579bf /tests
parent00e6f29b171b24121b9170e4608a69f0d824b299 (diff)
downloadquickjs-9d3776d0d45ca437ddb7f9079ae0367102abc90f.tar.gz
quickjs-9d3776d0d45ca437ddb7f9079ae0367102abc90f.zip
fixed break statement in the presence of labels (bnoordhuis) (#275)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_language.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_language.js b/tests/test_language.js
index 7e98d7a..11a45de 100644
--- a/tests/test_language.js
+++ b/tests/test_language.js
@@ -398,6 +398,24 @@ function test_labels()
while (0) x: { break x; };
}
+function test_labels2()
+{
+ while (1) label: break
+ var i = 0
+ while (i < 3) label: {
+ if (i > 0)
+ break
+ i++
+ }
+ assert(i, 1)
+ for (;;) label: break
+ for (i = 0; i < 3; i++) label: {
+ if (i > 0)
+ break
+ }
+ assert(i, 1)
+}
+
function test_destructuring()
{
function * g () { return 0; };
@@ -618,6 +636,7 @@ test_template_skip();
test_object_literal();
test_regexp_skip();
test_labels();
+test_labels2();
test_destructuring();
test_spread();
test_function_length();