diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/latin1/startsWith-endsWith.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/latin1/startsWith-endsWith.js')
-rw-r--r-- | js/src/jit-test/tests/latin1/startsWith-endsWith.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/latin1/startsWith-endsWith.js b/js/src/jit-test/tests/latin1/startsWith-endsWith.js new file mode 100644 index 000000000..eb49bea16 --- /dev/null +++ b/js/src/jit-test/tests/latin1/startsWith-endsWith.js @@ -0,0 +1,69 @@ +function toLatin1(s) { + assertEq(isLatin1(s), true); + return s; +} +function testStartsWith() { + var s1 = toLatin1("abc\u0099def"); + var s2 = toLatin1("abc\u0099d"); + var s3 = toLatin1("abc\u0098d"); + var s4 = toLatin1("bc\u0099"); + + // Latin1 + Latin1 + assertEq(s1.startsWith(s2), true); + assertEq(s1.startsWith(s3), false); + assertEq(s1.startsWith(s4), false); + assertEq(s1.startsWith(s4, 1), true); + assertEq(s1.startsWith(s1), true); + + // Latin1 + TwoByte + assertEq(s1.startsWith("abc\u0099\u1200".slice(0, -1)), true); + assertEq(s1.startsWith("abc\u0099e\u1200".slice(0, -1)), false); + assertEq(s1.startsWith("bc\u0099\u1200".slice(0, -1), 1), true); + assertEq(s1.startsWith("\u1200"), false); + + // TwoByte + Latin1 + var s5 = "abc\u0099de\u1200"; + assertEq(s5.startsWith(s1), false); + assertEq(s5.startsWith(s2), true); + assertEq(s5.startsWith(s4), false); + assertEq(s5.startsWith(s4, 1), true); + + // TwoByte + TwoByte + assertEq(s5.startsWith(s5), true); + assertEq(s5.startsWith("\u1200"), false); + assertEq(s5.startsWith("\u1200", 6), true); +} +testStartsWith(); + +function testEndsWith() { + var s1 = toLatin1("zabc\u0099defg"); + var s2 = toLatin1("\u0099defg"); + var s3 = toLatin1("\u0098defg"); + var s4 = toLatin1("zabc\u0099def"); + + // Latin1 + Latin1 + assertEq(s1.endsWith(s2), true); + assertEq(s1.endsWith(s3), false); + assertEq(s1.endsWith(s4), false); + assertEq(s1.endsWith(s4, 8), true); + assertEq(s1.endsWith(s1), true); + + // Latin1 + TwoByte + assertEq(s1.endsWith("abc\u0099defg\u1200".slice(0, -1)), true); + assertEq(s1.endsWith("\u1100efg\u1200".slice(0, -1)), false); + assertEq(s1.endsWith("bc\u0099\u1200".slice(0, -1), 5), true); + assertEq(s1.endsWith("\u1200"), false); + + // TwoByte + Latin1 + var s5 = "\u1200zabc\u0099defg"; + assertEq(s5.endsWith(s1), true); + assertEq(s5.endsWith(s2), true); + assertEq(s5.endsWith(s4), false); + assertEq(s5.endsWith(s4, 9), true); + + // TwoByte + TwoByte + assertEq(s5.endsWith(s5), true); + assertEq(s5.endsWith("\u1200"), false); + assertEq(s5.endsWith("\u1200za", 3), true); +} +testEndsWith(); |