Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: test/webkit/array-splice.js

Issue 144533006: Migrate crashing tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/webkit/array-splice-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) { }
« no previous file with comments | « no previous file | test/webkit/array-splice-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698