diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.6/12.6.1')
26 files changed, 608 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js new file mode 100644 index 000000000..c95c6ff1e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When the production "do Statement while ( Expression )" is evaluated, Statement is evaluated first + * + * @path ch12/12.6/12.6.1/S12.6.1_A1.js + * @description Evaluating various Expressions + */ + +var __in__do; + +do __in__do=1; while ( false ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do!==1) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=2; while ( 0 ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do!==2) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=3; while ( "" ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do!==3) { + $ERROR('#3: "" evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.js new file mode 100644 index 000000000..0c01a5e2e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.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. + +/** + * FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context + * + * @path ch12/12.6/12.6.1/S12.6.1_A10.js + * @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) { + $ERROR('#1: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A11.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A11.js new file mode 100644 index 000000000..60071bd6b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/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. + +/** + * Block "{}" in a "do-while" Expression is evaluated to true + * + * @path ch12/12.6/12.6.1/S12.6.1_A11.js + * @description Checking if execution of "do {} while({})" passes + */ + +do { + var __in__do=1; + if(__in__do)break; +} while({}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in do-while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.js new file mode 100644 index 000000000..1e623bc43 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Any statement within "do-while" construction must be a compound + * + * @path ch12/12.6/12.6.1/S12.6.1_A12.js + * @description Checking if execution of "do var x=1; var y =2; while (0)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do var x=1; var y =2; while (0); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.js new file mode 100644 index 000000000..38bc21491 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression within a "do-while" Expression is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A14_T1.js + * @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) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T2.js new file mode 100644 index 000000000..9ae3ad763 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression within a "do-while" Expression is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A14_T2.js + * @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) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js new file mode 100644 index 000000000..65588750c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "do-while" Expression is not allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A15.js + * @description Using "{0}" Block as an Expression + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + ; +}while({0}); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.js new file mode 100644 index 000000000..023c7d4a2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * While evaluating "do Statement while ( Expression )", Statement is evaluated first and only after it is done Expression is checked + * + * @path ch12/12.6/12.6.1/S12.6.1_A2.js + * @description Evaluating Statement with error Expression + */ + +try { + do __in__do = "reached"; while (abbracadabra); + $ERROR('#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") { + $ERROR('#1.1: __in__do === "reached". Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.js new file mode 100644 index 000000000..5f5f0ed69 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When the production "do Statement while ( Expression )" is evaluated, then (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.1/S12.6.1_A3.js + * @description Using eval "eval("do __in__do=1; while (false)")" + */ + +__evaluated = eval("do __in__do=1; while (false)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== 1) { + $ERROR('#1: __in__do === 1. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 1) { + $ERROR('#2: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T1.js new file mode 100644 index 000000000..917afe329 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T1.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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T1.js + * @description Using "break" within a "do-while" loop + */ + +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") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T2.js new file mode 100644 index 000000000..72e01a07d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T2.js + * @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)) { + $ERROR('#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) ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T3.js new file mode 100644 index 000000000..a6adc0836 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T3.js + * @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)) { + $ERROR('#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) ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.js new file mode 100644 index 000000000..52cb23cc9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T4.js + * @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)) { + $ERROR('#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) ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.js new file mode 100644 index 000000000..97f65bf59 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T5.js + * @description Using labeled "break" in order to continue a loop + */ + +//CHECK#1 +var i=0; +woohoo:{ + do{ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } while ( true ); + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.js new file mode 100644 index 000000000..67bc20de2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.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. + +/** + * After "do-while" is broken, (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.1/S12.6.1_A5.js + * @description Using eval + */ + +__evaluated = eval("do {__in__do__before__break=1; break; __in__do__after__break=2;} while(0)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T1.js new file mode 100644 index 000000000..40af77c63 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T1.js + * @description Checking if execution of "do{} while 1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T2.js new file mode 100644 index 000000000..06fb063ca --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T2.js + * @description Checking if execution of "do{} while 0" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 0; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T3.js new file mode 100644 index 000000000..b29c7c83f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T3.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T3.js + * @description Checking if execution of "do{}while true" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while true; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T4.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T4.js new file mode 100644 index 000000000..55b670506 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T4.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T4.js + * @description Checking if execution of "do{}while false" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while false; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T5.js new file mode 100644 index 000000000..4b0b06202 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T5.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T5.js + * @description Checking if execution of "do{}while ''" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while ''; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.js new file mode 100644 index 000000000..35e96f41e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T6.js + * @description Checking if execution of "do{}while 'hood'" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 'hood'; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.js new file mode 100644 index 000000000..78ca8c4ec --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.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. + +/** + * The "do-while" Statement is evaluted according to 12.6.1 and returns (normal, V, empty) + * + * @path ch12/12.6/12.6.1/S12.6.1_A7.js + * @description Using eval + */ + +var __condition=0 + +__evaluated = eval("do eval(\"__condition++\"); while (__condition<5)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "do-while" statement is evaluted according to the Standard '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "do-while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A8.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A8.js new file mode 100644 index 000000000..2f7c7e742 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/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. + +/** + * "continue" statement within a "do-while" Statement is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A8.js + * @description Using eval + */ + +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) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A9.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A9.js new file mode 100644 index 000000000..e9e831b07 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/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. + +/** + * "do-while" Statement is evaluated without syntax checks + * + * @path ch12/12.6/12.6.1/S12.6.1_A9.js + * @description Throwing system exception whithin a "do-while" loop + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + do { + var x = 1; + abaracadabara; + } while(0); + $ERROR('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +if (x !== 1) { + $ERROR('#1.1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/browser.js b/js/src/tests/test262/ch12/12.6/12.6.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/shell.js b/js/src/tests/test262/ch12/12.6/12.6.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/shell.js |