diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.7')
-rw-r--r-- | js/src/tests/test262/ch12/12.7/12.7-1.js | 21 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js | 19 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js | 21 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A1_T3.js | 23 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A1_T4.js | 22 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A2.js | 64 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A5_T1.js | 26 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A5_T2.js | 26 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A5_T3.js | 27 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A6.js | 19 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A7.js | 29 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A8_T1.js | 28 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A8_T2.js | 28 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A9_T1.js | 32 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/S12.7_A9_T2.js | 32 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/test262/ch12/12.7/shell.js | 0 |
17 files changed, 417 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.7/12.7-1.js b/js/src/tests/test262/ch12/12.7/12.7-1.js new file mode 100644 index 000000000..a19060a82 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/12.7-1.js @@ -0,0 +1,21 @@ +/// 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.7/12.7-1.js
+ * @description The continue Statement - a continue statement without an identifier may have a LineTerminator before the semi-colon
+ */
+
+
+function testcase() {
+ var sum = 0;
+ for (var i = 1; i <= 10; i++) {
+ continue
+ ;
+ sum += i;
+ }
+ return sum === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js new file mode 100644 index 000000000..ec172729f --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T1.js + * @description Checking if execution of single "continue" without any IterationStatement fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js new file mode 100644 index 000000000..2aa90f8b1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T2.js + * @description Checking if single "continue" with Label but without any IterationStatement fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T3.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T3.js new file mode 100644 index 000000000..4652dc865 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T3.js + * @description Checking if laballed "continue" with no IterationStatement, placed into a block, fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.js new file mode 100644 index 000000000..ac34f2642 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T4.js + * @description Checking if execution of "continue" with no IterationStatement, placed into a block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A2.js b/js/src/tests/test262/ch12/12.7/S12.7_A2.js new file mode 100644 index 000000000..3f76aa1a4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A2.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. + +/** + * Since LineTerminator between "continue" and Identifier is not allowed, "continue" is evaluated without label + * + * @path ch12/12.7/S12.7_A2.js + * @description Checking by using eval, inserting LineTerminator between continue and Identifier + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\u000AFOR1; } while(0);}"); + if (j!==2) { + $ERROR('#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#1.1: eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\\u000AFOR1; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\u000DFOR2; } while(0);}"); + if (j!==2) { + $ERROR('#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#2.1: eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\\u000DFOR2; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\u2028FOR3; } while(0);}"); + if (j!==2) { + $ERROR('#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#3.1: eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\\u2028FOR3; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\u2029FOR4; } while(0);}"); + if (j!==2) { + $ERROR('#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#4.1: eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\\u2029FOR4; } while(0);}"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T1.js new file mode 100644 index 000000000..14a8b5f7a --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_T1.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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T1.js + * @description Trying to continue another labeled loop + * @negative + */ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T2.js new file mode 100644 index 000000000..1d3f7e9c1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T2.js + * @description Identifier is a function name + * @negative + */ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T3.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T3.js new file mode 100644 index 000000000..16babd629 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T3.js + * @description Identifier is within loop label + * @negative + */ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_IN; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A6.js b/js/src/tests/test262/ch12/12.7/S12.7_A6.js new file mode 100644 index 000000000..11bb439aa --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A6.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. + +/** + * Appearing of "continue" within a function call that is within an IterationStatement yields SyntaxError + * + * @path ch12/12.7/S12.7_A6.js + * @description Using labaled "continue Identifier" within a function body + * @negative + */ + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){continue LABEL1;})(); + y++; +} while(0); + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A7.js b/js/src/tests/test262/ch12/12.7/S12.7_A7.js new file mode 100644 index 000000000..c43f701e1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A7.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. + +/** + * Appearing of continue within eval statement that is within an IterationStatement yields SyntaxError + * + * @path ch12/12.7/S12.7_A7.js + * @description Using eval "eval("continue LABEL1")" + */ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("continue LABEL1"); + y++; + } while(0); + $ERROR('#1: eval("continue LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR("1.1: Appearing of continue within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A8_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A8_T1.js new file mode 100644 index 000000000..76f8538a8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A8_T1.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. + +/** + * Appearing of "continue" within a "try/catch" Block yields SyntaxError + * + * @path ch12/12.7/S12.7_A8_T1.js + * @description Checking if execution of "continue Identifier" within catch Block fails + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue LABEL2; + LABEL2 : do { + x++; + y++; + } while(0); +}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A8_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A8_T2.js new file mode 100644 index 000000000..4d6f48e8b --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A8_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. + +/** + * Appearing of "continue" within a "try/catch" Block yields SyntaxError + * + * @path ch12/12.7/S12.7_A8_T2.js + * @description Checking if execution of "continue" within catch Block fails + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue; + LABEL2 : do { + x++; + y++; + } while(0); +}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A9_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A9_T1.js new file mode 100644 index 000000000..e6ab1f542 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A9_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. + +/** + * Continue inside of try-catch nested in a loop is allowed + * + * @path ch12/12.7/S12.7_A9_T1.js + * @description Using "continue Identifier" within catch Block that is within a loop + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.js new file mode 100644 index 000000000..8763414eb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.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. + +/** + * Continue inside of try-catch nested in a loop is allowed + * + * @path ch12/12.7/S12.7_A9_T2.js + * @description Using "continue" within catch Block that is within a loop + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/browser.js b/js/src/tests/test262/ch12/12.7/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/browser.js diff --git a/js/src/tests/test262/ch12/12.7/shell.js b/js/src/tests/test262/ch12/12.7/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/shell.js |