diff options
Diffstat (limited to 'website/resources/scripts/testcases2/15.4.4.12.json')
-rw-r--r-- | website/resources/scripts/testcases2/15.4.4.12.json | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/15.4.4.12.json b/website/resources/scripts/testcases2/15.4.4.12.json new file mode 100644 index 000000000..5a84b7269 --- /dev/null +++ b/website/resources/scripts/testcases2/15.4.4.12.json @@ -0,0 +1,21 @@ +{ + "testCollection": { + "name": "15.4.4.12", + "numTests": 2, + "tests": [ + { + "id": "15.4.4.12-9-a-1", + "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.12/15.4.4.12-9-a-1.js", + "description": "Array.prototype.splice - 'from' is the result of ToString(actualStart+k) in an Array", + "test": "assertTrue((function testcase() {\n var arrObj = [1, 2, 3];\n var newArrObj = arrObj.splice(-2, 1);\n return newArrObj.length === 1 && newArrObj[0] === 2;\n }).call(this));\n" + }, + { + "id": "15.4.4.12-9-c-ii-1", + "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.12/15.4.4.12-9-c-ii-1.js", + "description": "Array.prototype.splice will splice an array even when Array.prototype has index '0' set to read-only and 'fromPresent' less than 'actualDeleteCount (Step 9.c.ii)", + "test": "assertTrue((function testcase() {\n try {\n var arr = [\"a\", \"b\", \"c\"];\n Array.prototype[0] = \"test\";\n var newArr = arr.splice(2, 1, \"d\");\n\n var verifyValue = false;\n verifyValue = arr.length === 3 && arr[0] === \"a\" && arr[1] === \"b\" && arr[2] === \"d\"\n && newArr[0] === \"c\" && newArr.length === 1;\n\n var verifyEnumerable = false;\n for (var p in newArr) {\n if (newArr.hasOwnProperty(\"0\") && p === \"0\") {\n verifyEnumerable = true;\n }\n }\n\n var verifyWritable = false;\n newArr[0] = 12;\n verifyWritable = newArr[0] === 12;\n\n var verifyConfigurable = false;\n delete newArr[0];\n verifyConfigurable = newArr.hasOwnProperty(\"0\");\n\n return verifyValue && !verifyConfigurable && verifyEnumerable && verifyWritable;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n", + "precondition": "(fnExists(Object.defineProperty))" + } + ] + } +} |