summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/do-while
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/do-while
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/do-while')
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js44
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js31
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js22
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js32
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js25
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js38
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js33
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js31
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/cptn-normal.js25
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js19
-rw-r--r--js/src/tests/test262/language/statements/do-while/let-array-with-newline.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/do-while/tco-body-strict.js25
38 files changed, 910 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js
new file mode 100644
index 0000000000..e64f0f00f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "do Statement while ( Expression )" is evaluated,
+ Statement is evaluated first
+es5id: 12.6.1_A1
+description: Evaluating various Expressions
+---*/
+
+var __in__do;
+
+do __in__do=1; while ( false );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do!==1) {
+ throw new Test262Error('#1: the inner statement of a do-loop should be evaluated before the expression: false evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+do __in__do=2; while ( 0 );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__in__do!==2) {
+ throw new Test262Error('#2: the inner statement of a do-loop should be evaluated before the expression: 0 evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+do __in__do=3; while ( "" );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__in__do!==3) {
+ throw new Test262Error('#3: the inner statement of a do-loop should be evaluated before the expression: "" evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js
new file mode 100644
index 0000000000..64c23bfb0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionExpression within a "do-while" statement is allowed, but no
+ function with the given name will appear in the global context
+es5id: 12.6.1_A10
+description: Also this a test on FunctionExpression
+---*/
+
+var check = 0;
+do {
+ if(typeof(f) === "function"){
+ check = -1;
+ break;
+ } else {
+ check = 1;
+ break;
+ }
+} while(function f(){});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (check !== 1) {
+ throw new Test262Error('#1: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js
new file mode 100644
index 0000000000..76852700b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block "{}" in a "do-while" Expression is evaluated to true
+es5id: 12.6.1_A11
+description: Checking if execution of "do {} while({})" passes
+---*/
+
+do {
+ var __in__do=1;
+ if(__in__do)break;
+} while({});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== 1) {
+ throw new Test262Error('#1: "{}" in do-while expression evaluates to true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js
new file mode 100644
index 0000000000..cb4a56be30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Any statement within "do-while" construction must be a compound
+es5id: 12.6.1_A12
+description: Checking if execution of "do var x=1; var y =2; while (0)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do var x=1; var y =2; while (0);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js
new file mode 100644
index 0000000000..84901de992
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "do-while" Expression is allowed
+es5id: 12.6.1_A14_T1
+description: >
+ Using FunctionExpression "function __func(){return 0;}" as an
+ Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ var __reached = 1;
+ break;
+}while(function __func(){return 0;});
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expession inside of do-while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js
new file mode 100644
index 0000000000..489c70a1e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "do-while" Expression is allowed
+es5id: 12.6.1_A14_T2
+description: >
+ Using FunctionExpression "function __func(){return 0;}()" as an
+ Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ var __reached = 1;
+ break;
+}while(function __func(){return 0;}());
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expession inside of do-while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js
new file mode 100644
index 0000000000..95cae56e65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block within a "do-while" Expression is not allowed
+es5id: 12.6.1_A15
+description: Using "{0}" Block as an Expression
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ ;
+}while({0});
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js
new file mode 100644
index 0000000000..cd9c75047a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "do Statement while ( Expression )", Statement is
+ evaluated first and only after it is done Expression is checked
+es5id: 12.6.1_A2
+description: Evaluating Statement with error Expression
+---*/
+
+var __in__do;
+
+try {
+ do __in__do = "reached"; while (abbracadabra);
+ throw new Test262Error('#1: \'do __in__do = "reached"; while (abbracadabra)\' lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== "reached") {
+ throw new Test262Error('#1.1: __in__do === "reached". Actual: __in__do ==='+ __in__do );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js
new file mode 100644
index 0000000000..2a15fb2ceb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "do Statement while ( Expression )" is evaluated,
+ then (normal, V, empty) is returned
+es5id: 12.6.1_A3
+description: Using eval "eval("do __in__do=1; while (false)")"
+---*/
+
+var __evaluated, __in__do;
+
+__evaluated = eval("do __in__do=1; while (false)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if (__in__do !== 1) {
+ throw new Test262Error('#1: __in__do === 1. Actual: __in__do ==='+ __in__do );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 1) {
+ throw new Test262Error('#2: __evaluated === 1. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js
new file mode 100644
index 0000000000..e1a7bbb3a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T1
+description: Using "break" within a "do-while" loop
+---*/
+
+var __in__do__before__break, __in__do__after__break;
+
+do {
+ __in__do__before__break="reached";
+ break;
+ __in__do__after__break="where am i";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== "reached") {
+ throw new Test262Error('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js
new file mode 100644
index 0000000000..96b89c9678
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T2
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="black";
+ do_in : do {
+ var __in__do__IN__before__break="hole";
+ break do_in;
+ var __in__do__IN__after__break="sun";
+ } while (0);
+ var __in__do__after__break="won't you come";
+} while(2==1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js
new file mode 100644
index 0000000000..033acdc94e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T3
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="once";
+ do_in : do {
+ var __in__do__IN__before__break="in";
+ break do_out;
+ var __in__do__IN__after__break="the";
+ } while (0);
+ var __in__do__after__break="lifetime";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js
new file mode 100644
index 0000000000..b8d50678f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T4
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="reached";
+ do_in : do {
+ var __in__do__IN__before__break="reached";
+ break;
+ var __in__do__IN__after__break="where am i";
+ } while (0);
+ var __in__do__after__break="where am i";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js
new file mode 100644
index 0000000000..c844659070
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T5
+description: Using labeled "break" in order to continue a loop
+---*/
+
+var i = 0;
+woohoo:{
+ do {
+ i++;
+ if ( i == 10 ) {
+ break woohoo;
+ throw new Test262Error('#1.1: "break woohoo" must break loop');
+ }
+ } while ( true );
+ throw new Test262Error('This code should be unreacheable');
+}
+assert.sameValue(i, 10);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js
new file mode 100644
index 0000000000..4ac0097fca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: After "do-while" is broken, (normal, V, empty) is returned
+es5id: 12.6.1_A5
+description: Using eval
+---*/
+
+var __evaluated, __in__do__before__break, __in__do__after__break;
+
+__evaluated = eval("do {__in__do__before__break=1; break; __in__do__after__break=2;} while(0)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== 1) {
+ throw new Test262Error('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__evaluated !== 1) {
+ throw new Test262Error('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js
new file mode 100644
index 0000000000..39ca929015
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T1
+description: Checking if execution of "do{} while 1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js
new file mode 100644
index 0000000000..8811244140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T2
+description: Checking if execution of "do{} while 0" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 0;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js
new file mode 100644
index 0000000000..5359a7fdb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T3
+description: Checking if execution of "do{}while true" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while true;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js
new file mode 100644
index 0000000000..ee6a831710
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T4
+description: Checking if execution of "do{}while false" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while false;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js
new file mode 100644
index 0000000000..f378c8d8ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T5
+description: Checking if execution of "do{}while ''" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while '';
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js
new file mode 100644
index 0000000000..11c9eaa4ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T6
+description: Checking if execution of "do{}while 'hood'" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 'hood';
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js
new file mode 100644
index 0000000000..b36adeb89d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The "do-while" Statement is evaluted according to 12.6.1 and returns
+ (normal, V, empty)
+es5id: 12.6.1_A7
+description: Using eval
+---*/
+
+var __evaluated;
+var __condition=0
+
+__evaluated = eval("do eval(\"__condition++\"); while (__condition<5)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__condition !== 5) {
+ throw new Test262Error('#1: The "do-while" statement is evaluted according to the Standard ');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: The "do-while" statement returns (normal, V, empty)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js
new file mode 100644
index 0000000000..4c4c3bc0d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"continue\" statement within a \"do-while\" Statement is allowed"
+es5id: 12.6.1_A8
+description: Using eval
+---*/
+
+var __evaluated;
+var __condition = 0, __odds=0;
+
+__evaluated = eval("do { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;} while(__condition < 10)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__odds !== 5) {
+ throw new Test262Error('#1: __odds === 5. Actual: __odds ==='+ __odds );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js
new file mode 100644
index 0000000000..2f7797fa22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"do-while\" Statement is evaluated without syntax checks"
+es5id: 12.6.1_A9
+description: Throwing system exception whithin a "do-while" loop
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ do {
+ var x = 1;
+ abaracadabara;
+ } while(0);
+ throw new Test262Error('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+
+if (x !== 1) {
+ throw new Test262Error('#1.1: x === 1. Actual: x ==='+ x );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/browser.js b/js/src/tests/test262/language/statements/do-while/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/browser.js
diff --git a/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..9a92df2acf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.2.6
+description: >
+ Completion value when iteration completes due to an empty abrupt completion
+info: |
+ IterationStatement : do Statement while ( Expression ) ;
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let stmt be the result of evaluating Statement.
+ b. If LoopContinues(stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+---*/
+
+assert.sameValue(eval('1; do { break; } while (false)'), undefined);
+assert.sameValue(eval('2; do { 3; break; } while (false)'), 3);
+
+assert.sameValue(eval('4; do { continue; } while (false)'), undefined);
+assert.sameValue(eval('5; do { 6; continue; } while (false)'), 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/cptn-normal.js b/js/src/tests/test262/language/statements/do-while/cptn-normal.js
new file mode 100644
index 0000000000..d7ec585dc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/cptn-normal.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.2.6
+description: >
+ Completion value when iteration completes due to expression value
+info: |
+ IterationStatement : do Statement while ( Expression ) ;
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let stmt be the result of evaluating Statement.
+ b. If LoopContinues(stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+ c. If stmt.[[value]] is not empty, let V = stmt.[[value]].
+ d. Let exprRef be the result of evaluating Expression.
+ e. Let exprValue be GetValue(exprRef).
+ f. ReturnIfAbrupt(exprValue).
+ g. If ToBoolean(exprValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; do { } while (false)'), undefined);
+assert.sameValue(eval('2; do { 3; } while (false)'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/decl-async-fun.js b/js/src/tests/test262/language/statements/do-while/decl-async-fun.js
new file mode 100644
index 0000000000..52c1ba75de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+do async function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-async-gen.js b/js/src/tests/test262/language/statements/do-while/decl-async-gen.js
new file mode 100644
index 0000000000..1315a2e7ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+do async function* g() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-cls.js b/js/src/tests/test262/language/statements/do-while/decl-cls.js
new file mode 100644
index 0000000000..401d86cc0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do class C {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-const.js b/js/src/tests/test262/language/statements/do-while/decl-const.js
new file mode 100644
index 0000000000..d60a5a45cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do const x = null; while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-fun.js b/js/src/tests/test262/language/statements/do-while/decl-fun.js
new file mode 100644
index 0000000000..66395ee5cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-gen.js b/js/src/tests/test262/language/statements/do-while/decl-gen.js
new file mode 100644
index 0000000000..2a716ad42c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+do function* g() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-let.js b/js/src/tests/test262/language/statements/do-while/decl-let.js
new file mode 100644
index 0000000000..96d3a7da14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do let x; while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js b/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js
new file mode 100644
index 0000000000..cdbb8b5efe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+do label1: label2: function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js b/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js
new file mode 100644
index 0000000000..5432938f52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+do let
+[x] = 0
+while (false);
diff --git a/js/src/tests/test262/language/statements/do-while/shell.js b/js/src/tests/test262/language/statements/do-while/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/do-while/tco-body-strict.js b/js/src/tests/test262/language/statements/do-while/tco-body-strict.js
new file mode 100644
index 0000000000..9db9f3abd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/tco-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ do {
+ return f(n - 1);
+ } while (false)
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);