summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug943126.js
blob: 319274fb2f1ed7df511098f7b11378cc965bb5fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Test fast-path for String.split("").

load(libdir + 'eqArrayHelper.js');

assertEqArray("".split(""), []);
assertEqArray("a".split(""), ["a"]);
assertEqArray("abc".split(""), ["a", "b", "c"]);

assertEqArray("abcd".split("", 2), ["a", "b"]);
assertEqArray("abcd".split("", 0), []);
assertEqArray("abcd".split("", -1), ["a", "b", "c", "d"]);

// Note: V8 disagrees about this one, but we are correct by ecma-262 15.5.4.14 part 9.
assertEqArray("abcd".split(undefined, 0), []);

assertEqArray("abcd".split(undefined, 1), ["abcd"]);