aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/8.1_The_Undefined_Type.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/8.1_The_Undefined_Type.json')
-rw-r--r--website/resources/scripts/testcases2/8.1_The_Undefined_Type.json50
1 files changed, 50 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/8.1_The_Undefined_Type.json b/website/resources/scripts/testcases2/8.1_The_Undefined_Type.json
new file mode 100644
index 000000000..00b6139ac
--- /dev/null
+++ b/website/resources/scripts/testcases2/8.1_The_Undefined_Type.json
@@ -0,0 +1,50 @@
+{
+ "testCollection": {
+ "name": "8.1_The_Undefined_Type",
+ "numTests": 7,
+ "tests": [
+ {
+ "section": "8.1",
+ "description": "Checking if execution of \"var x = undefined\" passes",
+ "test": "// CHECK#1\nvar x = undefined;\n",
+ "id": "S8.1_A1_T1"
+ },
+ {
+ "section": "8.1",
+ "description": "Check typeof(undefined) and typeof(void 0)",
+ "test": "// CHECK#1\nif (!(typeof(undefined) === \"undefined\")) { \n\tERROR('#1: typeof(undefined) === \"undefined\". Actual: ' + (typeof(undefined))); \n} \n\n// CHECK#2\nif (!(typeof(void 0) === \"undefined\")) { \n\tERROR('#2: typeof(void 0) === \"undefined\". Actual: ' + (typeof(void 0))); \n}\n\n// CHECK#3\nif (!(undefined === void 0)) { \n\tERROR('#3: undefined === void 0'); \n}\n",
+ "id": "S8.1_A1_T2"
+ },
+ {
+ "section": "8.1",
+ "description": "Check that var x have value and type undefined",
+ "test": "var x;\n\n///////////////////////////////////////////////////////////////////\n// CHECK#1\nif (!(x === undefined)) {\n $ERROR('#1: var x; x === undefined. Actual: ' + (x));\n}\n//\n///////////////////////////////////////////////////////////////////\n\n///////////////////////////////////////////////////////////////////\n// CHECK#2\nif (!(typeof(x) === \"undefined\")) {\n $ERROR('#2: var x; typeof(x) === \"undefined\". Actual: ' + (typeof(x)));\n}\n//\n///////////////////////////////////////////////////////////////////\n\n///////////////////////////////////////////////////////////////////\n// CHECK#3\nif (!(x === void 0)) {\n $ERROR('#3: var x; x === void 0. Actual: ' + (x));\n}\n//\n///////////////////////////////////////////////////////////////////\n",
+ "id": "S8.1_A2_T1"
+ },
+ {
+ "section": "8.1",
+ "description": "Function return undefined",
+ "test": "// CHECK#1\nfunction test1(x) {\n\treturn x;\n}\n\nif (!(test1() === void 0)) {\n $ERROR('#1: function test1(x){return x} test1() === void 0. Actual: ' + (test1()));\n}\n\n// CHECK#2\nfunction test2() { \n}\n\nif (!(test2() === void 0)) {\n $ERROR('#2: function test2(){} test2() === void 0. Actual: ' + (test2()));\n}\n",
+ "id": "S8.1_A2_T2"
+ },
+ {
+ "section": "8.1",
+ "description": "\"undefined=1\" should throw a TypeError",
+ "test": "//////////////////////////////////////////////////////////\n// CHECK1#\nvar undefined = 1;\n//\n//////////////////////////////////////////////////////////\n",
+ "id": "S8.1_A3"
+ },
+ {
+ "section": "8.1",
+ "description": "Check value of not existed property",
+ "test": "// CHECK#1 \nif ((new Object()).newProperty !== undefined) {\n $ERROR('#1: (new Object()).newProperty === undefined. Actual: ' + ((new Object()).newProperty));\n} \n\n",
+ "id": "S8.1_A4"
+ },
+ {
+ "section": "8.1",
+ "description": "Call function without provided argument",
+ "test": "///////////////////////////////////////\n//\nfunction test(arg) {\n// Check and make sure that arg is not undefined\n\tif (typeof(arg) !== \"undefined\") {\n $ERROR('#1: Function argument that isn\\'t provided has a value of undefined. Actual: ' + (typeof(arg)));\n }\n}\n\ntest();\n//\n////////////////////////////////////////\n",
+ "id": "S8.1_A5"
+ }
+ ]
+ }
+}