Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Test fast-path for String.split(""). |
michael@0 | 2 | |
michael@0 | 3 | load(libdir + 'eqArrayHelper.js'); |
michael@0 | 4 | |
michael@0 | 5 | assertEqArray("".split(""), []); |
michael@0 | 6 | assertEqArray("a".split(""), ["a"]); |
michael@0 | 7 | assertEqArray("abc".split(""), ["a", "b", "c"]); |
michael@0 | 8 | |
michael@0 | 9 | assertEqArray("abcd".split("", 2), ["a", "b"]); |
michael@0 | 10 | assertEqArray("abcd".split("", 0), []); |
michael@0 | 11 | assertEqArray("abcd".split("", -1), ["a", "b", "c", "d"]); |
michael@0 | 12 | |
michael@0 | 13 | // Note: V8 disagrees about this one, but we are correct by ecma-262 15.5.4.14 part 9. |
michael@0 | 14 | assertEqArray("abcd".split(undefined, 0), []); |
michael@0 | 15 | |
michael@0 | 16 | assertEqArray("abcd".split(undefined, 1), ["abcd"]); |