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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 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 | « test/webkit/Object-create-expected.txt ('k') | 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/stack-unwinding.js b/test/webkit/array-splice.js
similarity index 59%
copy from test/webkit/stack-unwinding.js
copy to test/webkit/array-splice.js
index 0a898274a679e6176b326378149f552fbc6365a4..045e39e3794095e790332b43dda7de4232ec76dd 100644
--- a/test/webkit/stack-unwinding.js
+++ b/test/webkit/array-splice.js
@@ -22,43 +22,40 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-
-"This test checks that JavaScriptCore does not crash when uwinding the stack that includes a host function."
-
+"This tests array.splice behavior."
);
-function twoHostFunctions() {
- var stack = [];
- stack.push({ "args": twoHostFunctions.arguments });
- stack.push({ "args": twoHostFunctions.arguments });
- testPassed("Two host functions called in a row.");
-}
-
-function arrayOperatorFunction(element) {
- return element + 5;
-}
-
-var myArray = new Array (0, 1, 2);
-function hostCallsUser(array) {
- return array.map(arrayOperatorFunction);
-}
-
-function throwException() {
- throw "Exception thrown";
-}
-
-function hostAndException() {
- var stack = [];
- stack.push({ "args": hostAndException.arguments });
- throwException();
-}
-
-twoHostFunctions();
-myArray = hostCallsUser(myArray);
-shouldBe(myArray, new Array( 5, 6, 7 ) );
-
+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 {
- hostAndException();
-} catch (e) {
- testPassed("Exception thrown and caught");
-}
+ String(Array(0xFFFFFFFD).splice(0));
+} catch (e) { }
« no previous file with comments | « test/webkit/Object-create-expected.txt ('k') | test/webkit/array-splice-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698