diff --git a/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js b/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js index 526b1a0b6d2c0e6a3c5a11e402ce6dbd544e828d..5ea599e757ad65db815e0bb45ea220f4803cc95e 100644 --- a/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js +++ b/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js @@ -6,7 +6,7 @@ * @section: 12.10; * @assertion: No matter how control leaves the embedded 'Statement', the scope chain is always restored to its former state; * @description: Declaring "with" statement within a function constructor, leading to completion by exception; - * @strict_mode_negative + * @noStrict */ this.p1 = 1; diff --git a/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js b/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js deleted file mode 100644 index b576f4fee590fdfa6a5a1ec064b855a25e778bef..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * @name: S12.10_A3.3_T5; - * @section: 12.10; - * @assertion: No matter how control leaves the embedded 'Statement', - * the scope chain is always restored to its former state; - * @description: Declaring "with" statement within a function constructor, leading to completion by exception; - * @strict_mode_negative - */ - -this.p1 = 1; - -var result = "result"; - -var myObj = { - p1: 'a', - value: 'myObj_value', - valueOf : function(){return 'obj_valueOf';} -} - -try { - function __FACTORY(){ - with(myObj){ - throw value; - p1 = 'x1'; - } - } - var obj = new __FACTORY(); -} catch(e){ - result = p1; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if(result !== 1){ - $ERROR('#1: result === 1. Actual: result ==='+ result ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if(p1 !== 1){ - $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if(myObj.p1 !== "a"){ - $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/sputnik/Conformance/12_Statement/12.1_Block/S12.1_A1.js b/test/suite/sputnik/Conformance/12_Statement/12.1_Block/S12.1_A1.js deleted file mode 100644 index e4f2a2cafaf4ccb46ed9ad843d3c784e7b0da190..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.1_Block/S12.1_A1.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.1_A1; -* @section: 12.1; -* @assertion: The production Block { } in strict code can't contain function declaration; -* @description: Trying to declare function at the Block statement; -* @negative -* @errortype: SyntaxError; -*/ - -"use strict"; -{ - function __func(){} -} diff --git a/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js b/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js deleted file mode 100644 index ad3707604032bf20d5e0ff50ccee06ae1e107782..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.5_A9_T1; -* @section: 12.5; -* @assertion: Function declaration within an "if" statement in strict code is not allowed; -* @description: Declaring function within an "if" statement; -* @negative -* @errortype: SyntaxError; -*/ - -"use strict"; -if (true) { - function __func(){}; -} else { - function __func(){}; -} diff --git a/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js b/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js deleted file mode 100644 index 87f8f70575decb5579757892f61aac671a517acd..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.5_A9_T2; -* @section: 12.5; -* @assertion: Function declaration within an "if" statement in strict code is not allowed; -* @description: Declaring function within an "if" that is declared within the strict function; -* @negative -* @errortype: SyntaxError; -*/ - -(function(){ -"use strict"; - -if (true) { - function __func(){}; -} else { - function __func(){}; -} - -}); diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js deleted file mode 100644 index 42a311c536091a002241d8b56abde722e263ce7a..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.1_A13_T1; -* @section: 12.6.1, 13; -* @assertion: FunctionDeclaration within a "do-while" Block in strict code is not allowed; -* @description: Declaring function within a "do-while" loop; -* @negative -* @errortype: SyntaxError; -*/ - -"use strict"; -do{ - function __func(){}; -} while(0); diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js deleted file mode 100644 index a85d0ca145ae13645c70b03af61bca358e4b3f3d..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.1_A13_T2; -* @section: 12.6.1, 13; -* @assertion: FunctionDeclaration within a "do-while" Block in strict code is not allowed; -* @description: Declaring a function within a "do-while" loop that is within a strict function; -* @negative -* @errortype: SyntaxError; -*/ - -(function(){ -"use strict"; -do{ - function __func(){}; -}while(0); - -}); diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js deleted file mode 100644 index 15542d5cfe906fcf1e7c95458cb966efc7c585a6..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.2_A13_T1; -* @section: 12.6.2; -* @assertion: FunctionDeclaration within a "while" Statement is not allowed; -* @description: Checking if declaring a function within a "while" Statement leads to an exception; -* @negative; -*/ - -while(0){ - function __func(){}; -}; diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js deleted file mode 100644 index 9ffccd7ea8bdf57605cd47f92992605f340529f5..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.2_A13_T2; -* @section: 12.6.2; -* @assertion: FunctionDeclaration within a "while" Statement is not allowed; -* @description: Checking if declaring a function within a "while" Statement that is in a function call leads to an exception; -* @negative; -*/ - -(function(){ - -while(0){ - function __func(){}; -}; - -})(); diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js deleted file mode 100644 index 442596cb802fa0398c0ac5e7d278ee9dae27c6f1..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.4_A13_T1; -* @section: 12.6.4; -* @assertion: FunctionDeclaration within a "for-in" Statement is not allowed; -* @description: Declaring function within a "for-in" Statement; -* @negative; -*/ - -for(x in this){ - function __func(){}; -}; diff --git a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js b/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js deleted file mode 100644 index 382d3052066e6914c85db69300d43db046f3b810..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.6.4_A13_T2; -* @section: 12.6.4; -* @assertion: FunctionDeclaration within a "for-in" Statement is not allowed; -* @description: Declaring function within a "for-in" Statement that is within a function call; -* @negative; -*/ - -(function(){ - -for(x in this){ - function __func(){}; -}; - -})(); diff --git a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js b/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js deleted file mode 100644 index 9d2c52cea1124738127c580f05a4cd4fd99ead39..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.7_A3; -* @section: 12.7; -* @assertion: When "continue Identifier" is evaluated (continue, empty, empty) is returned; -* @description: Simple using continue without Identifier and labeled loop; -*/ - -LABEL_OUT : var x=0, y=0; - -LABEL_DO_LOOP : do { - LABEL_IN : x=2; - continue ; - LABEL_IN_2 : var y=2; - - function IN_DO_FUNC(){} -} while(0); - -LABEL_ANOTHER_LOOP : do { - ; -} while(0); - -function OUT_FUNC(){} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if ((x!==2)&&(y!==0)) { - $ERROR('#1: x === 2 and y === 0. Actual: x ==='+x+' and y ==='+ y ); -} -// -////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js b/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js deleted file mode 100644 index 98b70a4e9b51e303fa45c21354a620853172d54b..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.7_A4_T1; -* @section: 12.7; -* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; -* @description: Simple using continue Identifier construction; -*/ - -LABEL_OUT : var x=0, y=0; - -LABEL_DO_LOOP : do { - LABEL_IN : x++; - if(x===10)break; - continue LABEL_DO_LOOP; - LABEL_IN_2 : y++; - - function IN_DO_FUNC(){} -} while(0); - -LABEL_ANOTHER_LOOP : do { - ; -} while(0); - -function OUT_FUNC(){} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if ((x!==1)&&(y!==0)) { - $ERROR('#1: x===1 and y === 0. Actual: x==='+x+' and y ==='+y); -} -// -////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js b/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js deleted file mode 100644 index 21a35182c7e591446257163fcf6dc22237aa250f..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.7_A4_T2; -* @section: 12.7; -* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; -* @description: Using embedded and labeled loops, continue to nested loop; -*/ - -LABEL_OUT : var x=0, y=0, xx=0, yy=0; - -LABEL_DO_LOOP : do { - LABEL_IN : x++; - if(x===10)break; - LABEL_NESTED_LOOP : do { - LABEL_IN_NESTED : xx++; - if(xx===10)break; - continue LABEL_NESTED_LOOP; - LABEL_IN_NESTED_2 : yy++; - } while (0); - - LABEL_IN_2 : y++; - - function IN_DO_FUNC(){} -} while(0); - -LABEL_ANOTHER_LOOP : do { - ; -} while(0); - -function OUT_FUNC(){} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if ((x!==1)&&(y!==1)&&(xx!==1)&(yy!==0)) { - $ERROR('#1: (x===1) and (y===1) and (xx===1) and (yy===0). Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); -} -// -////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js b/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js deleted file mode 100644 index 7e94b84aa2f8e1a34af26043af237c9fb9d24c39..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S12.7_A4_T3; -* @section: 12.7; -* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; -* @description: Using embedded and labeled loops, continue to outer loop; -*/ - -LABEL_OUT : var x=0, y=0, xx=0, yy=0; - -LABEL_DO_LOOP : do { - LABEL_IN : x++; - if(x===10)break; - LABEL_NESTED_LOOP : do { - LABEL_IN_NESTED : xx++; - if(xx===10)break; - continue LABEL_DO_LOOP; - LABEL_IN_NESTED_2 : yy++; - } while (0); - - LABEL_IN_2 : y++; - - function IN_DO_FUNC(){} -} while(0); - -LABEL_ANOTHER_LOOP : do { - ; -} while(0); - -function OUT_FUNC(){} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) { - $ERROR('#1: (x===1) and (y===0) and (xx===1) and (yy===0). Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); -} -// -////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A17_T1.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A17_T1.js deleted file mode 100644 index 095eab745a369e27ae3fc8bf0c178c7006a157a7..0000000000000000000000000000000000000000 --- a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A17_T1.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** -* @name: S13.2.2_A17_T1; -* @section: 13.2.2; -* @assertion: FunctionExpression containing "with" statement is admitted; -* @description: Using "with" statement within a function body; -*/ - -var p1="alert"; - -var __obj={p1:1,getRight:function(){return "right";}}; - -this.getRight=function(){return "napravo";}; - -(function(){ - with(__obj){ - p1="w1"; - function getRight(){return false;} - } -})(); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (p1!=="alert") { - $ERROR('#1: p1 === "alert". Actual: p1==='+p1); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (getRight()!=="napravo") { - $ERROR('#2: getRight() === "napravo". Actual: getRight() === '+getRight()); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (__obj.p1!=="w1") { - $ERROR('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#4 -if (__obj.getRight()!=="right") { - $ERROR('#4: __obj.getRight() === "right". Actual: __obj.getRight() ==='+__obj.getRight()); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A1_T1.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A1_T1.js new file mode 100644 index 0000000000000000000000000000000000000000..1ce8f7d5fc53d056ea77fa5d744af7d15c29de73 --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A1_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. + +/** + * The production Block { } in strict code can't contain function + * declaration; + * + * @description: Trying to declare function at the Block statement; + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +{ + function __func(){} +} diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_T1.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_T1.js new file mode 100644 index 0000000000000000000000000000000000000000..7a949dfb51d1374088387fafceb4febb78b73276 --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_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. + +/** + * Function declaration within an "if" statement in strict code is not + * allowed + * + * @description Declaring function within a strict "if" statement + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +if (true) { + function __func(){}; +} else { + function __func(){}; +} diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_T2.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_T2.js new file mode 100644 index 0000000000000000000000000000000000000000..e7ee11ed2081b868351a2f8ff1bebbfacf9dd10e --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A2_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. + +/** + * Function declaration within an "if" statement in strict code is not allowed; + * + * @description Declaring function within an "if" that is declared + * within the strict function + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +(function(){ + if (true) { + function __func(){}; + } else { + function __func(){}; + } +}); diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_T1.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_T1.js new file mode 100644 index 0000000000000000000000000000000000000000..2708cfdae84309b8d4e74c59af45bca4fc0e5edd --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_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. + +/** + * FunctionDeclaration within a "do-while" Block in strict code is not + * allowed + * + * @description Declaring function within a "do-while" loop + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls +*/ + +do { + function __func(){}; +} while(0); diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_T2.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_T2.js new file mode 100644 index 0000000000000000000000000000000000000000..40d1cbfab4c4efd6cfa4210a663b00e5eb734d7a --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A3_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. + +/** + * FunctionDeclaration within a "do-while" Block in strict code is not allowed + * + * @description Declaring a function within a "do-while" loop that is + * within a strict function + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +(function(){ + do { + function __func(){}; + } while(0); +}); diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_T1.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_T1.js new file mode 100644 index 0000000000000000000000000000000000000000..930aa6dfc78b33e1a96641b67fe98f1337a1ad3b --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_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. + +/** + * FunctionDeclaration within a "while" Statement is not allowed + * + * @description Checking if declaring a function within a "while" + * Statement leads to an exception + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +while (0) { + function __func(){}; +}; diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_T2.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_T2.js new file mode 100644 index 0000000000000000000000000000000000000000..d32d956f54d010b03cf5681b0a47a683f0ee49b5 --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A4_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. + +/** + * FunctionDeclaration within a "while" Statement is not allowed + * + * @description Checking if declaring a function within a "while" + * Statement that is in a function call leads to an exception + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls +*/ + +(function(){ + while (0) { + function __func(){}; + }; +})(); diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_T1.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_T1.js new file mode 100644 index 0000000000000000000000000000000000000000..268f460b77fb32e5f8ef555a95e0a51f0322d469 --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration within a "for-in" Statement is not allowed + * + * @description: Declaring function within a "for-in" Statement + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +for (x in this) { + function __func(){}; +} diff --git a/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_T2.js b/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_T2.js new file mode 100644 index 0000000000000000000000000000000000000000..56e6ec976591f6169cd0fb866107f7750cdb285f --- /dev/null +++ b/test/suite/sputnik/Conformance/bestPractice/Sbp_A5_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. + +/** + * FunctionDeclaration within a "for-in" Statement is not allowed + * + * @description Declaring function within a "for-in" Statement that is + * within a function call + * @negative SyntaxError + * @onlyStrict + * @bestPractice + * http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls + */ + +(function(){ + for (x in this) { + function __func(){}; + } +})();