Index: test/webkit/array-splice.js |
diff --git a/test/webkit/throw-from-finally.js b/test/webkit/array-splice.js |
similarity index 59% |
copy from test/webkit/throw-from-finally.js |
copy to test/webkit/array-splice.js |
index 183245d8d1ade776fcfbbc822236a3a8009537cd..045e39e3794095e790332b43dda7de4232ec76dd 100644 |
--- a/test/webkit/throw-from-finally.js |
+++ b/test/webkit/array-splice.js |
@@ -22,59 +22,40 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"This tests that throwing from a finally block has the expected effect." |
+"This tests array.splice behavior." |
); |
-var events = []; |
- |
-try { |
- events.push("1:try"); |
-} finally { |
- events.push("1:finally"); |
-} |
- |
-try { |
- try { |
- throw "2:thingy"; |
- } finally { |
- events.push("2:finally"); |
- } |
-} catch (e) { |
- events.push(e); |
-} |
- |
+var arr = ['a','b','c','d']; |
+shouldBe("arr", "['a','b','c','d']"); |
+shouldBe("arr.splice(2)", "['c','d']"); |
+shouldBe("arr", "['a','b']"); |
+shouldBe("arr.splice(0)", "['a','b']"); |
+shouldBe("arr", "[]") |
+ |
+arr = ['a','b','c','d']; |
+shouldBe("arr.splice()", "[]") |
+shouldBe("arr", "['a','b','c','d']"); |
+shouldBe("arr.splice(undefined)", "['a','b','c','d']") |
+shouldBe("arr", "[]"); |
+ |
+arr = ['a','b','c','d']; |
+shouldBe("arr.splice(null)", "['a','b','c','d']") |
+shouldBe("arr", "[]"); |
+ |
+arr = ['a','b','c','d']; |
+shouldBe("arr.splice(100)", "[]") |
+shouldBe("arr", "['a','b','c','d']"); |
+shouldBe("arr.splice(-1)", "['d']") |
+shouldBe("arr", "['a','b','c']"); |
+ |
+shouldBe("arr.splice(2, undefined)", "[]") |
+shouldBe("arr.splice(2, null)", "[]") |
+shouldBe("arr.splice(2, -1)", "[]") |
+shouldBe("arr", "['a','b','c']"); |
+shouldBe("arr.splice(2, 100)", "['c']") |
+shouldBe("arr", "['a','b']"); |
+ |
+// Check this doesn't crash. |
try { |
- throw "3:thingy"; |
-} catch (e) { |
- events.push(e); |
-} finally { |
- events.push("3:finally"); |
-} |
- |
-try { |
- try { |
- throw "4:thingy"; |
- } catch (e) { |
- events.push(e); |
- } finally { |
- events.push("4:finally"); |
- throw "4:another thingy"; |
- } |
-} catch (e) { |
- events.push(e); |
-} |
- |
-try { |
- for (;;) { |
- try { |
- continue; |
- } finally { |
- events.push("5:hi"); |
- throw "5:wat"; |
- } |
- } |
-} catch (e) { |
- events.push(e); |
-} |
- |
-shouldBe("\"\" + events", "\"1:try,1:finally,2:finally,2:thingy,3:thingy,3:finally,4:thingy,4:finally,4:another thingy,5:hi,5:wat\""); |
+ String(Array(0xFFFFFFFD).splice(0)); |
+} catch (e) { } |