aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/bestPractice
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/bestPractice')
-rw-r--r--test/suite/bestPractice/Sbp_12.5_A9_T3.js21
-rw-r--r--test/suite/bestPractice/Sbp_12.6.1_A13_T3.js19
-rw-r--r--test/suite/bestPractice/Sbp_12.6.2_A13_T3.js19
-rw-r--r--test/suite/bestPractice/Sbp_12.6.4_A13_T3.js19
4 files changed, 78 insertions, 0 deletions
diff --git a/test/suite/bestPractice/Sbp_12.5_A9_T3.js b/test/suite/bestPractice/Sbp_12.5_A9_T3.js
new file mode 100644
index 000000000..e9cbb0eb3
--- /dev/null
+++ b/test/suite/bestPractice/Sbp_12.5_A9_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.
+
+/**
+ * Function declaration within an "if" statement is not allowed
+ *
+ * @path bestPractice/Sbp_12.5_A9_T3.js
+ * @description Declaring function within an "if" statement that is declared within the function declaration
+ * @negative
+ */
+
+function(){
+
+if (true) {
+ function __func(){};
+} else {
+ function __func(){};
+}
+
+};
+
diff --git a/test/suite/bestPractice/Sbp_12.6.1_A13_T3.js b/test/suite/bestPractice/Sbp_12.6.1_A13_T3.js
new file mode 100644
index 000000000..943aa2182
--- /dev/null
+++ b/test/suite/bestPractice/Sbp_12.6.1_A13_T3.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 is not allowed
+ *
+ * @path bestPractice/Sbp_12.6.1_A13_T3.js
+ * @description Declaring a function within a "do-while" loop that is within a function declaration itself
+ * @negative
+ */
+
+function(){
+
+do{
+ function __func(){};
+}while(0);
+
+};
+
diff --git a/test/suite/bestPractice/Sbp_12.6.2_A13_T3.js b/test/suite/bestPractice/Sbp_12.6.2_A13_T3.js
new file mode 100644
index 000000000..17bfdab66
--- /dev/null
+++ b/test/suite/bestPractice/Sbp_12.6.2_A13_T3.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
+ *
+ * @path bestPractice/Sbp_12.6.2_A13_T3.js
+ * @description Checking if declaring a function within a "while" Statement that is in a function body leads to an exception
+ * @negative
+ */
+
+function(){
+
+while(0){
+ function __func(){};
+};
+
+};
+
diff --git a/test/suite/bestPractice/Sbp_12.6.4_A13_T3.js b/test/suite/bestPractice/Sbp_12.6.4_A13_T3.js
new file mode 100644
index 000000000..f76366167
--- /dev/null
+++ b/test/suite/bestPractice/Sbp_12.6.4_A13_T3.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
+ *
+ * @path bestPractice/Sbp_12.6.4_A13_T3.js
+ * @description Declaring function within a "for-in" Statement that is within function declaration
+ * @negative
+ */
+
+function(){
+
+for(x in this){
+ function __func(){};
+};
+
+};
+