diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.6')
133 files changed, 3591 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 diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js new file mode 100644 index 000000000..cb7fff722 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression from "while" IterationStatement is evaluated first; "false", "0", "null", "undefined" and "empty" strings used as the Expression are evaluated to "false" + * + * @path ch12/12.6/12.6.2/S12.6.2_A1.js + * @description Evaluating various Expressions + */ + +var __in__do; + +while ( false ) __in__do=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== undefined) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( 0 ) __in__do=2; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do !== undefined) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( "" ) __in__do=3; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do !== undefined) { + $ERROR('#3: empty string evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( null ) __in__do=4; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__in__do !== undefined) { + $ERROR('#4: null evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( undefined ) __in__do=35; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__in__do !== undefined) { + $ERROR('#5: undefined evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js new file mode 100644 index 000000000..9a05fe317 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is allowed, but no function with the given name will appear in the global context + * + * @path ch12/12.6/12.6.2/S12.6.2_A10.js + * @description Testing FunctionExpression too + */ + +var check=0; +while(function f(){}){ + if(typeof(f) === "function") { + check = -1; + break; + } else { + check = 1; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression inside while construction expression allowed but function not declare'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js new file mode 100644 index 000000000..6ff4c779c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 within a "while" Expression is evaluated to true + * + * @path ch12/12.6/12.6.2/S12.6.2_A11.js + * @description Checking if execution of "while({}){}" passes + */ + +while({}){ + var __in__do=1; + if(__in__do)break; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js new file mode 100644 index 000000000..f27b9df26 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T1.js + * @description Using "function __func(){return 0;}" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 0;}){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js new file mode 100644 index 000000000..cd867ea97 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T2.js + * @description Using function call as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 1;}()){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js new file mode 100644 index 000000000..e1e231dd4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Expression is not allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A15.js + * @description Expression is "{0}" + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while({1}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js new file mode 100644 index 000000000..e3994d474 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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. + +/** + * While evaluating The production IterationStatement: "while ( Expression ) Statement", Expression is evaluated first + * + * @path ch12/12.6/12.6.2/S12.6.2_A2.js + * @description Evaluating Statement with error Expression + */ + +try { + while ((function(){throw 1})()) __in__while = "reached"; + $ERROR('#1: \'while ((function(){throw 1})()) __in__while = "reached"\' lead to throwing exception'); +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+e); + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __in__while !== "undefined") { + $ERROR('#1.1: typeof __in__while === "undefined". Actual: typeof __in__while ==='+typeof __in__while); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js new file mode 100644 index 000000000..ec8934e8e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.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. + +/** + * When "while" IterationStatement is evaluated, (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A3.js + * @description Using eval + */ + +var __in__do; + +__evaluated = eval("while (false) __in__do=1;"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== undefined) { + $ERROR('#1: __in__do === undefined. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== undefined) { + $ERROR('#2: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js new file mode 100644 index 000000000..5e20d53ba --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T1.js + * @description "break" within a "while" Statement + */ + +while(1===1){ + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} + +////////////////////////////////////////////////////////////////////////////// +//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.2/S12.6.2_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js new file mode 100644 index 000000000..616145c02 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T2.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="black"; + do_in : while (1) { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } ; + var __in__do__after__break="won't you come"; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js new file mode 100644 index 000000000..a86e95705 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.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 "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T3.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="once"; + do_in : while (1) { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } ; + var __in__do__after__break="lifetime"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js new file mode 100644 index 000000000..4dc75f137 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T4.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if(__in__do__before__break)break; + var __in__do__before__break="can't"; + do_in : while (1) { + var __in__do__IN__before__break="get"; + break; + var __in__do__IN__after__break="no"; + } ; + var __in__do__after__break="Satisfaction"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js new file mode 100644 index 000000000..46e5b95c7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T5.js + * @description Using labeled "break" in order to continue a "while" loop + */ + +//CHECK#1 +var i=0; +woohoo:{ + while(true){ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js new file mode 100644 index 000000000..899837466 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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. + +/** + * While using "while" within an eval statement, source "break" is allowed and (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A5.js + * @description Using eval + */ + +__evaluated = eval("while(1) {__in__do__before__break=1; break; __in__do__after__break=2;}"); + +////////////////////////////////////////////////////////////////////////////// +//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.2/S12.6.2_A6_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js new file mode 100644 index 000000000..f9a4e9744 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T1.js + * @description Checking if execution of "while 1 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 1 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js new file mode 100644 index 000000000..b7f61b8b4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T2.js + * @description Checking if execution of "while 0 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 0 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js new file mode 100644 index 000000000..4b0eaea03 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T3.js + * @description Checking if execution of "while true break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while true break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js new file mode 100644 index 000000000..8d17ce8f1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T4.js + * @description Checking if execution of "while false break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while false break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js new file mode 100644 index 000000000..e1b677741 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T5.js + * @description Checking if execution of "while '' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while '' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js new file mode 100644 index 000000000..78ce3abdb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T6.js + * @description Checking if execution of "while 'hood' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 'hood' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js new file mode 100644 index 000000000..5743cd6d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Statement is evaluted according to 12.6.2 and returns (normal, V, empty) + * + * @path ch12/12.6/12.6.2/S12.6.2_A7.js + * @description using eval + */ + +var __condition=0 + +__evaluated = eval("while (__condition<5) eval(\"__condition++\");"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "while" statement is evaluated as described in the Standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js new file mode 100644 index 000000000..a5af5748d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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 "while" Statement is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A8.js + * @description using eval + */ + +var __condition = 0, __odds=0; + +__evaluated = eval("while(__condition < 10) { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;}"); + +////////////////////////////////////////////////////////////////////////////// +//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.2/S12.6.2_A9.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js new file mode 100644 index 000000000..f8cbed0a1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_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. + +/** + * "while" Statement is evaluated without syntax checks + * + * @path ch12/12.6/12.6.2/S12.6.2_A9.js + * @description Throwing system exception inside "while" loop + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + while(x!=1) { + var x = 1; + abaracadabara; + }; + $ERROR('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +if (x !== 1) { + $ERROR('#1.1: while statement evaluates as is, without syntax checks'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/browser.js b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/shell.js b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js new file mode 100644 index 000000000..a0aa03156 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is an Object with value false
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var obj = { value: false };
+ for (var i = 0; obj; ) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js new file mode 100644 index 000000000..cc1cb63d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is '1')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("1");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js new file mode 100644 index 000000000..2bccf56df --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is undefined
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; undefined;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js new file mode 100644 index 000000000..6698b966b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is null
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; null;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js new file mode 100644 index 000000000..4e7d39333 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a boolean (value is false)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; false;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js new file mode 100644 index 000000000..865f68d77 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is NaN)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; NaN;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js new file mode 100644 index 000000000..8f85811f3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is +0)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; +0;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js new file mode 100644 index 000000000..20d03326e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is -0)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; -0;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js new file mode 100644 index 000000000..faca41566 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is a positive)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; 2;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js new file mode 100644 index 000000000..8fc6251de --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is empty string)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; "";) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js new file mode 100644 index 000000000..19dc79e05 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is 'undefined')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "undefined";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js new file mode 100644 index 000000000..eaf600c6e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Boolean object
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var boolObj = new Boolean(false);
+ for (var i = 0; boolObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js new file mode 100644 index 000000000..6c8e61c59 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is 'null')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "null";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js new file mode 100644 index 000000000..d83bd0b18 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is '1')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "1";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js new file mode 100644 index 000000000..76f27f8bd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is NaN)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(NaN);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js new file mode 100644 index 000000000..81599d37b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is +0)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(+0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js new file mode 100644 index 000000000..5a3199947 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is -0)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(-0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js new file mode 100644 index 000000000..6f8ed9cd3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is a positive)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(12);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js new file mode 100644 index 000000000..920911c94 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is empty string)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js new file mode 100644 index 000000000..f087aa207 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is 'undefined')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("undefined");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js new file mode 100644 index 000000000..45ed58923 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is 'null')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("null");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.js new file mode 100644 index 000000000..dd200559c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.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. + +/** + * The "for {;;}" for Statement with empty expressions is allowed and leads to performing an infinite loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A1.js + * @description Breaking an infinite loop by throwing exception + */ + +var __in__for = 0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for (;;){ + //__in__for++; + if(++__in__for>100)throw 1; +} +} catch (e) { + if (e !== 1) { + $ERROR('#1: for {;;} is admitted and leads to infinite loop'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== 101) { + $ERROR('#2: __in__for === 101. Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js new file mode 100644 index 000000000..13bfc59ff --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js @@ -0,0 +1,111 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Nested "var-loops" nine blocks depth is evaluated properly + * + * @path ch12/12.6/12.6.3/S12.6.3_A10.1.js + * @description Checking if executing nested "var-loops" nine blocks depth is evaluated properly + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + index0=index0; +} catch (e) { + $ERROR('#2: "index0=index0" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + index1=index1; +} catch (e) { + $ERROR('#3: "index1=index1" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try { + index4=index4; +} catch (e) { + $ERROR('#4: "index4=index4" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +try { + index5=index5; +} catch (e) { + $ERROR('#4: "index5=index5" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +try { + index7=index7; +} catch (e) { + $ERROR('#6: "index7=index7" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +try { + index8=index8; +} catch (e) { + $ERROR('#7: "index8=index8" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( var index0=0; index0<=1; index0++) { + for(var index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for(var index4=0; index4<=index3; index4++) { + for(var index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for(var index7=0; index7<=index6; index7++) { + for(var index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js new file mode 100644 index 000000000..fb17b0b2c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Nested "var-loops" nine blocks depth is evaluated properly + * + * @path ch12/12.6/12.6.3/S12.6.3_A10.js + * @description Checking if executing nested "var-loops" nine blocks depth is evaluated properly + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( index0=0; index0<=1; index0++) { + for( index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for( index4=0; index4<=index3; index4++) { + for( index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for( index7=0; index7<=index6; index7++) { + for( index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js new file mode 100644 index 000000000..d050b3dbc --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js + * @description Using "continue" in order to continue a loop + */ + +__str="" + +for(var index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js new file mode 100644 index 000000000..cc0233d41 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js new file mode 100644 index 000000000..d02abf292 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.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. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js + * @description Trying to continue non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js new file mode 100644 index 000000000..192f1ebd5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T1.js + * @description Simple test of continue loop with using "continue" + */ + +__str="" + +for(index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js new file mode 100644 index 000000000..cdc606b5c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.js new file mode 100644 index 000000000..2807bc86f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.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. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T3.js + * @description Trying to continue non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js new file mode 100644 index 000000000..48fc3b30c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js + * @description Breaking a loop with "break" + */ + +__str="" + +for(var index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1: __str === "012345". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js new file mode 100644 index 000000000..939fd991d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js new file mode 100644 index 000000000..96a5accd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js + * @description Trying to break non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js new file mode 100644 index 000000000..55031321d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T1.js + * @description Breaking a loop with "break" + */ + +__str="" + +for(index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1:__str === "012345". Actual: __str ==='+__str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js new file mode 100644 index 000000000..e97dc7da3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.js new file mode 100644 index 000000000..67fd236cd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.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. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T3.js + * @description Trying to break non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.js new file mode 100644 index 000000000..452902537 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.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. + +/** + * VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A13.js + * @description Declaring variable in "for" ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + index = index; +} catch (e) { + $ERROR('#1: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +for(var index=0; index<6; index++) { + ; +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.js new file mode 100644 index 000000000..182482dd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement" + * + * @path ch12/12.6/12.6.3/S12.6.3_A14.js + * @description Using +,*,/, as the second Expression + */ + +//CHECK#1 +for(var i=0;i<10;i++){} +if (i!==10) $ERROR('#1: i === 10. Actual: i ==='+ i ); + +//CHECK#2 +var j=0; +for(var i=1;i<10;i*=2){ + j++; +} +if (i!==16) $ERROR('#2.1: i === 16. Actual: i ==='+ i ); +if (j!==4) $ERROR('#2.2: j === 4. Actual: j ==='+ j ); + +//CHECK#3 +var j=0; +for(var i=16;i>1;i=i/2){ + j++; +} +if (i!==1) $ERROR('#3.1: i === 1. Actual: i ==='+ i ); +if (j!==4) $ERROR('#3.2: j === 4. Actual: j ==='+ j ); + +//CHECK#4 +var j=0; +for(var i=10;i>1;i--){ + j++; +} +if (i!==1) $ERROR('#4.1: i === 1. Actual: i ==='+ i ); +if (j!==9) $ERROR('#4.2: j === 9. Actual: j ==='+ j ); + +//CHECK#5 +var j=0; +for(var i=2;i<10;i*=i){ + j++; +} +if (i!==16) $ERROR('#5.1: i === 16. Actual: i ==='+ i ); +if (j!==2) $ERROR('#5.2: j === 2. Actual: j ==='+ j ); + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.js new file mode 100644 index 000000000..4ec6147b9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement" + * + * @path ch12/12.6/12.6.3/S12.6.3_A15.js + * @description Statement must be evaluated before second Expression is evaluated + */ + +//CHECK#1 +for(var i=0;i<10;i++){ + i*=2; + break; +} +if (i!==0) $ERROR('#1: i === 0. Actual: i ==='+ i ); + +//CHECK#2 +for(var i=0;i<10;i++){ + i*=2; + if (i===3) $ERROR('#2: i !== 3'); +} + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.js new file mode 100644 index 000000000..78372a2d7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.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. + +/** + * While evaluating "for (ExpressionNoIn ; ; Expression) Statement", Statement is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.1.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})(); ;(function(){throw "SecondExpression"})()) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#2: When for (ExpressionNoIn ; ; Expression) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.js new file mode 100644 index 000000000..f6391e2f7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.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. + +/** + * While evaluating "for (ExpressionNoIn;;) Statement", Statement is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.2.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})();;) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; ; ) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.js new file mode 100644 index 000000000..86718d9d1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.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. + +/** + * While evaluating "for (ExpressionNoIn; Expression; Expression) Statement", ExpressionNoIn is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression";})(); (function(){throw "FirstExpression";})(); (function(){throw "SecondExpression";})()) { + var in_for = "reached"; + } + $ERROR('#1: (function(){throw "NoInExpression";})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; Expression ; Expression) Statement is evaluated ExpressionNoIn evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (in_for !== undefined) { + $ERROR('#2: in_for === undefined. Actual: in_for ==='+ in_for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js new file mode 100644 index 000000000..2c46dbfbb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement", ExpressionNoIn is evaulated first, FirstExpressoin is evaluated second + * + * @path ch12/12.6/12.6.3/S12.6.3_A3.js + * @description Using "(function(){throw "FirstExpression"})()" as FirstExpression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){__in__NotInExpression__ = "checked";__in__NotInExpression__2 = "passed";})(); (function(){throw "FirstExpression"})(); (function(){throw "SecondExpression"})()) { + __in__for="reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"} lead to throwing exception'); +} catch (e) { + if (e !== "FirstExpression") { + $ERROR('#1: When for (ExpressionNoIn ; FirstExpression ; SecondExpression) Statement is evaluated first evaluates ExpressionNoIn then FirstExpression'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if ((__in__NotInExpression__ !== "checked")&(__in__NotInExpression__2!=="passed")) { + $ERROR('#2: (__in__NotInExpression__ === "checked")&(__in__NotInExpression__2==="passed")'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __in__for !== "undefined") { + $ERROR('#3: typeof __in__for === "undefined". Actual: typeof __in__for ==='+ typeof __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.js new file mode 100644 index 000000000..a64935274 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4.1.js + * @description Checking if execution of "for (var a in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (var a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T1.js new file mode 100644 index 000000000..48e56c4b1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4_T1.js + * @description Checking if execution of "for (a in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.js new file mode 100644 index 000000000..2a292a808 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4_T2.js + * @description Checking if execution of "for (1 in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(1 in arr;1;) { + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.js new file mode 100644 index 000000000..6cab0f017 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.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. + +/** + * "in"-expression wrapped into "eval" statement is allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A5.js + * @description Using eval "for(eval("i in arr");1;)" + */ + +arr = [1,2,3,4,5]; +i = 1; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(eval("i in arr");1;) {break;}; +} catch (e) { + $ERROR('#1.1: for(eval("i in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + for(eval("var i = 1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#2.1: for(eval("var i = 1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + for(eval("1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#3.1: for(eval("1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.js new file mode 100644 index 000000000..1dfd5b457 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.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. + +/** + * While evaluating "for ( ; ; Expression) Statement", Statement is evaluated first and then Expression is evaluated + * + * @path ch12/12.6/12.6.3/S12.6.3_A6.js + * @description Using "(function(){throw "SecondExpression";})()" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(;;(function(){throw "SecondExpression";})()){ + var __in__for = "reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"}() lead to throwing exception'); +} catch (e) { + if (e !== "SecondExpression") { + $ERROR('#1: When for ( ; ; Expression) Statement is evaluated Statement evaluates first then Expression evaluates'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== "reached") { + $ERROR('#2: __in__for === "reached". Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js new file mode 100644 index 000000000..f8b2fdbd0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only three expressions and two semicolons in "for(with var)" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js + * @description Checking if execution of "for(var index=0; index<10; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index++; index--); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js new file mode 100644 index 000000000..550b14b19 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only three expressions and two semicolons in "for(with var)" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js + * @description Checking if execution of "for(var index=0; index<10; index+=4; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.js new file mode 100644 index 000000000..39dcc1c6a --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only three expressions and two semicolons in "for" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7_T1.js + * @description Checking if execution of "for(index=0; index<10; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.js new file mode 100644 index 000000000..2f22dbf3c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only three expressions and two semicolons in "for" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7_T2.js + * @description Checking if execution of "for(index=0; index<10; index+=4; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js new file mode 100644 index 000000000..ddd3c30e4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.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. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js + * @description Checking if execution of "for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js new file mode 100644 index 000000000..81cbed22b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js + * @description Checking if execution of "for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js new file mode 100644 index 000000000..8c26060e3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js + * @description Checking if execution of "for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.js new file mode 100644 index 000000000..8f9ce29d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.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. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T1.js + * @description Checking if execution of "for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.js new file mode 100644 index 000000000..406d23bbb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.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. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T2.js + * @description Checking if execution of "for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js new file mode 100644 index 000000000..9843a3229 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T3.js + * @description Checking if execution of "for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.js new file mode 100644 index 000000000..c2031c9ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.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. + +/** + * The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty) + * + * @path ch12/12.6/12.6.3/S12.6.3_A9.1.js + * @description Using eval + */ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.js new file mode 100644 index 000000000..11b88316f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.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. + +/** + * The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty) + * + * @path ch12/12.6/12.6.3/S12.6.3_A9.js + * @description Using eval + */ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/browser.js b/js/src/tests/test262/ch12/12.6/12.6.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/shell.js b/js/src/tests/test262/ch12/12.6/12.6.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js new file mode 100644 index 000000000..3929b0a23 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js @@ -0,0 +1,34 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch12/12.6/12.6.4/12.6.4-1.js
+ * @description The for-in Statement - a property name must not be visited more than once in any enumeration.
+ */
+
+
+function testcase() {
+ var obj = { prop1: "abc", prop2: "bbc", prop3: "cnn" };
+
+ var countProp1 = 0;
+ var countProp2 = 0;
+ var countProp3 = 0;
+
+ for (var p in obj) {
+ if (obj.hasOwnProperty(p)) {
+ if (p === "prop1") {
+ countProp1++;
+ }
+ if (p === "prop2") {
+ countProp2++;
+ }
+ if (p === "prop3") {
+ countProp3++;
+ }
+ }
+ }
+ return countProp1 === 1 && countProp2 === 1 && countProp3 === 1;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js new file mode 100644 index 000000000..dca36c1ff --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js @@ -0,0 +1,52 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch12/12.6/12.6.4/12.6.4-2.js
+ * @description The for-in Statement - the values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object is shadowed by a previous object on the prototype chain
+ */
+
+
+function testcase() {
+ var obj = {};
+
+ var proto = {};
+
+ Object.defineProperty(proto, "prop", {
+ value: "inheritedValue",
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+
+ var ConstructFun = function () { };
+ ConstructFun.prototype = proto;
+
+ var child = new ConstructFun();
+
+ Object.defineProperty(child, "prop1", {
+ value: "overridedValue1",
+ enumerable: false
+ });
+ Object.defineProperty(child, "prop2", {
+ value: "overridedValue2",
+ enumerable: true
+ });
+ var accessedProp1 = false;
+ var accessedProp2 = false;
+
+ for (var p in child) {
+ if (child.hasOwnProperty(p)) {
+ if (p === "prop1") {
+ accessedProp1 = true;
+ }
+ if (p === "prop2") {
+ accessedProp2 = true;
+ }
+ }
+ }
+ return !accessedProp1 && accessedProp2 && child.prop1 === "overridedValue1" && child.prop2 === "overridedValue2";
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.js new file mode 100644 index 000000000..fd8c754bf --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.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. + +/** + * "for(key in undefined)" Statement is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A1.js + * @description Checking if execution of "for(key in undefined)" passes + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(__key in undefined){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(key in undefined){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key === '+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.js new file mode 100644 index 000000000..b90e3e99b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpession within a "for-in" Expression is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A14_T2.js + * @description Using "function __func(){return {a:1};}()" as Expession + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in function __func(){return {a:1};}()){ + var __reached = x; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== "a") { + $ERROR('#2: function expession inside of for-in expression allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js new file mode 100644 index 000000000..c19908904 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "for-in" Expression is not allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A15.js + * @description Using block within "for-in" Expression + * @negative + */ + +var __arr=[1,2,3]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in {__arr}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.js new file mode 100644 index 000000000..e8db640c0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.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. + +/** + * "for(key in null)" Expression is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A2.js + * @description Checking if execution of "for(key in null)" passes + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + for(__key in null){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(__key in null){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key ==='+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.js new file mode 100644 index 000000000..d232fe48d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A3.1.js + * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers + */ + +__str=""; + +__evaluated = eval("for(var ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.js new file mode 100644 index 000000000..2b34c38c7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A3.js + * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers. Eval is used + */ + +__str=""; + +__evaluated = eval("for(ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.js new file mode 100644 index 000000000..a491b3f34 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A4.1.js + * @description Using Object as an Expression is appropriate. Eval is used + */ + +__str=""; + +__evaluated = eval("for(var ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.js new file mode 100644 index 000000000..79f496b8c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A4.js + * @description Using Object as an Expression is appropriate. Eval is used + */ + +__str=""; + +__evaluated = eval("for(ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.js new file mode 100644 index 000000000..37992e1dd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A5.1.js + * @description Using hierarchical Object as an Expression is appropriate. The depth is two + */ + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(var __key in __hash__map){ + for (var __ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.js new file mode 100644 index 000000000..974659f10 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A5.js + * @description Using hierarchical Object as an Expression is appropriate. The depth is two + */ + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(__key in __hash__map){ + for (__ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.js new file mode 100644 index 000000000..78cc2e842 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A6.1.js + * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" + */ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (var key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.js new file mode 100644 index 000000000..5a1f8d9c2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A6.js + * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" + */ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.js new file mode 100644 index 000000000..1105b7ff2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Properties of the object being enumerated may be deleted during enumeration + * + * @path ch12/12.6/12.6.4/S12.6.4_A7_T1.js + * @description Checking "for (LeftHandSideExpression in Expression) Statement" case + */ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (__key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T2.js new file mode 100644 index 000000000..48be196ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Properties of the object being enumerated may be deleted during enumeration + * + * @path ch12/12.6/12.6.4/S12.6.4_A7_T2.js + * @description Checking "for (var VariableDeclarationNoIn in Expression) Statement" case + */ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (var __key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/browser.js b/js/src/tests/test262/ch12/12.6/12.6.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/shell.js b/js/src/tests/test262/ch12/12.6/12.6.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/shell.js diff --git a/js/src/tests/test262/ch12/12.6/browser.js b/js/src/tests/test262/ch12/12.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/browser.js diff --git a/js/src/tests/test262/ch12/12.6/shell.js b/js/src/tests/test262/ch12/12.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/shell.js |