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/toLowerCase-toUpperCase.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/toLowerCase-toUpperCase.js')
-rw-r--r-- | js/src/jit-test/tests/latin1/toLowerCase-toUpperCase.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/latin1/toLowerCase-toUpperCase.js b/js/src/jit-test/tests/latin1/toLowerCase-toUpperCase.js new file mode 100644 index 000000000..d1855dc3d --- /dev/null +++ b/js/src/jit-test/tests/latin1/toLowerCase-toUpperCase.js @@ -0,0 +1,57 @@ +function testToLowerCase() { + var s1 = "abcdefgABCDEFGH 123456"; + assertEq(isLatin1(s1), true); + + // Latin1 + var s2 = s1.toLowerCase(); + assertEq(isLatin1(s2), true); + assertEq(s2, "abcdefgabcdefgh 123456"); + + s2 = s1.toLocaleLowerCase(); + assertEq(isLatin1(s2), true); + assertEq(s2, "abcdefgabcdefgh 123456"); + + // TwoByte + s2 = "abcdefg\u1200ABCDEFGH 123456\u04AC".toLowerCase(); + assertEq(s2, "abcdefg\u1200abcdefgh 123456\u04AD"); + + s2 = "abcdefg\u1200ABCDEFGH 123456\u04AC".toLocaleLowerCase(); + assertEq(s2, "abcdefg\u1200abcdefgh 123456\u04AD"); + + // For toLowerCase, every Latin1 character maps to a Latin1 character. + for (var i=0; i <= 0xff; i++) { + var s = "\u1200\u11AA" + String.fromCharCode(i); + assertEq(s.toLowerCase().charCodeAt(2) <= 0xff, true); + } +} +testToLowerCase(); + +function testToUpperCase() { + var s1 = "abcdefgABCDEFGH 12345"; + assertEq(isLatin1(s1), true); + + // Latin1 + var s2 = s1.toUpperCase(); + assertEq(isLatin1(s2), true); + assertEq(s2, "ABCDEFGABCDEFGH 12345"); + + s2 = s1.toLocaleUpperCase(); + assertEq(isLatin1(s2), true); + assertEq(s2, "ABCDEFGABCDEFGH 12345"); + + // TwoByte + s2 = "abcdefg\u1200ABCDEFGH 12345\u1E0F".toUpperCase(); + assertEq(s2, "ABCDEFG\u1200ABCDEFGH 12345\u1E0E"); + + s2 = "abcdefg\u1200ABCDEFGH 12345\u1E0F".toLocaleUpperCase(); + assertEq(s2, "ABCDEFG\u1200ABCDEFGH 12345\u1E0E"); + + // Tricky case: Latin1 character \u00FF maps to \u0178, a + // non-Latin1 character. + s1 = "ABC\u00FF"; + assertEq(isLatin1(s1), true); + s2 = s1.toUpperCase(); + assertEq(isLatin1(s2), false); + assertEq(s2, "ABC\u0178"); +} +testToUpperCase(); |