diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement')
39 files changed, 1202 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.js new file mode 100644 index 000000000..2d75c69c1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.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. + +/** +* @name: S12.6.3_A1; +* @section: 12.6.3; +* @assertion: The "for {;;}" for Statement with empty expressions is allowed and leads to performing an infinite loop; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js new file mode 100644 index 000000000..b49105566 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A10.1; +* @section: 12.6.3; +* @assertion: Nested "var-loops" nine blocks depth is evaluated properly; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.js new file mode 100644 index 000000000..2548489ee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A10; +* @section: 12.6.3; +* @assertion: Nested "var-loops" nine blocks depth is evaluated properly; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T1.js new file mode 100644 index 000000000..ec4db06db --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.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. + +/** +* @name: S12.6.3_A11.1_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T2.js new file mode 100644 index 000000000..b6654593c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T2.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. + +/** +* @name: S12.6.3_A11.1_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.js new file mode 100644 index 000000000..7b54ec8f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.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. + +/** +* @name: S12.6.3_A11.1_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T1.js new file mode 100644 index 000000000..dfad4ec90 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_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. + +/** +* @name: S12.6.3_A11_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T2.js new file mode 100644 index 000000000..5657f2ed8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T2.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. + +/** +* @name: S12.6.3_A11_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.js new file mode 100644 index 000000000..7bfec8231 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.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. + +/** +* @name: S12.6.3_A11_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T1.js new file mode 100644 index 000000000..b65e699a3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.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. + +/** +* @name: S12.6.3_A12.1_T1; +* @section: 12.6.3; +* @assertion: 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"; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T2.js new file mode 100644 index 000000000..861ad63d5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.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. + +/** +* @name: S12.6.3_A12.1_T2; +* @section: 12.6.3; +* @assertion: 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"; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.js new file mode 100644 index 000000000..ce159e5c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.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. + +/** +* @name: S12.6.3_A12.1_T3; +* @section: 12.6.3; +* @assertion: 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"; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T1.js new file mode 100644 index 000000000..c5933fe19 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_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. + +/** +* @name: S12.6.3_A12_T1; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T2.js new file mode 100644 index 000000000..38b79a552 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_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. + +/** +* @name: S12.6.3_A12_T2; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.js new file mode 100644 index 000000000..6c5cb096b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.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. + +/** +* @name: S12.6.3_A12_T3; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.js new file mode 100644 index 000000000..c1a29a61f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.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. + +/** +* @name: S12.6.3_A13; +* @section: 12.6.3; +* @assertion: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js new file mode 100644 index 000000000..e7175d1b6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A14; +* @section: 12.6.3; +* @assertion: The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement"; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.js new file mode 100644 index 000000000..dc1f1334a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.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. + +/** +* @name: S12.6.3_A15; +* @section: 12.6.3; +* @assertion: The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement"; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.js new file mode 100644 index 000000000..fe918cf41 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.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. + +/** +* @name: S12.6.3_A2.1; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn ; ; Expression) Statement", Statement is evaulated first; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.js new file mode 100644 index 000000000..cb86f7c6e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.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. + +/** +* @name: S12.6.3_A2.2; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn;;) Statement", Statement is evaulated first; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.js new file mode 100644 index 000000000..4a11b60e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.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. + +/** +* @name: S12.6.3_A2; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn; Expression; Expression) Statement", ExpressionNoIn is evaulated first; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js new file mode 100644 index 000000000..eca306838 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A3; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement", ExpressionNoIn is evaulated first, FirstExpressoin is evaluated second; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.js new file mode 100644 index 000000000..d58a2c5c0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.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. + +/** +* @name: S12.6.3_A4.1; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T1.js new file mode 100644 index 000000000..5edc7abc4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_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. + +/** +* @name: S12.6.3_A4_T1; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.js new file mode 100644 index 000000000..9efa95ab3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.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. + +/** +* @name: S12.6.3_A4_T2; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.js new file mode 100644 index 000000000..b83bcd6ee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.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. + +/** +* @name: S12.6.3_A5; +* @section: 12.6.3; +* @assertion: "in"-expression wrapped into "eval" statement is allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.js new file mode 100644 index 000000000..b3f3b8140 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.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. + +/** +* @name: S12.6.3_A6; +* @section: 12.6.3; +* @assertion: While evaluating "for ( ; ; Expression) Statement", Statement is evaluated first and then Expression is evaluated; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T1.js new file mode 100644 index 000000000..6e16d3751 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_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. + +/** +* @name: S12.6.3_A7.1_T1; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T2.js new file mode 100644 index 000000000..99e250cda --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_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. + +/** +* @name: S12.6.3_A7.1_T2; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T1.js new file mode 100644 index 000000000..10773f81c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_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. + +/** +* @name: S12.6.3_A7_T1; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T2.js new file mode 100644 index 000000000..fe0909232 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_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. + +/** +* @name: S12.6.3_A7_T2; +* @section: 12.6.3; +* @assertion: 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; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T1.js new file mode 100644 index 000000000..9f41bbabc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.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. + +/** +* @name: S12.6.3_A8.1_T1; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.js new file mode 100644 index 000000000..0a0b3bb75 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.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. + +/** +* @name: S12.6.3_A8.1_T2; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.js new file mode 100644 index 000000000..1d69bbf1a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.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. + +/** +* @name: S12.6.3_A8.1_T3; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T1.js new file mode 100644 index 000000000..cf797bc5f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_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. + +/** +* @name: S12.6.3_A8_T1; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T2.js new file mode 100644 index 000000000..48ae1831f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_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. + +/** +* @name: S12.6.3_A8_T2; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.js new file mode 100644 index 000000000..0009790e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.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. + +/** +* @name: S12.6.3_A8_T3; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.js new file mode 100644 index 000000000..2a9598766 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.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. + +/** +* @name: S12.6.3_A9.1; +* @section: 12.6.3; +* @assertion: The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty); +* @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/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.js new file mode 100644 index 000000000..6bc4b9149 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.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. + +/** +* @name: S12.6.3_A9; +* @section: 12.6.3; +* @assertion: The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty); +* @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'); +} +// +////////////////////////////////////////////////////////////////////////////// |