| 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) { }
|
|
|