summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-09-05 15:27:11 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-06 15:24:27 +0100
commit207319ecf1d5b6ba6e5c0df820bb542e9c2dce92 (patch)
tree2bf539cd5587a1e07bb729661c84b1473e80a61a /Userland/Libraries/LibJS/Tests
parent14086c69e79720328115d55720e75c0382fd328f (diff)
downloadserenity-207319ecf1d5b6ba6e5c0df820bb542e9c2dce92.zip
LibJS: Implement ECMA-402 String.prototype.toLocale{Lower,Upper}Case
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleLowerCase.js21
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleUpperCase.js15
2 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleLowerCase.js b/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleLowerCase.js
index 730cb31aec..941944cbb4 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleLowerCase.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleLowerCase.js
@@ -25,4 +25,25 @@ test("special case folding", () => {
expect("\u1FB7".toLocaleLowerCase()).toBe("\u1FB7");
expect("\u1FC7".toLocaleLowerCase()).toBe("\u1FC7");
expect("\u1FF7".toLocaleLowerCase()).toBe("\u1FF7");
+
+ expect("I".toLocaleLowerCase()).toBe("i");
+ expect("I".toLocaleLowerCase("az")).toBe("\u0131");
+ expect("I".toLocaleLowerCase("tr")).toBe("\u0131");
+
+ expect("\u0130".toLocaleLowerCase()).toBe("\u0069\u0307");
+ expect("\u0130".toLocaleLowerCase("az")).toBe("i");
+ expect("\u0130".toLocaleLowerCase("tr")).toBe("i");
+
+ expect("I\u0307".toLocaleLowerCase()).toBe("i\u0307");
+ expect("I\u0307".toLocaleLowerCase("az")).toBe("i");
+ expect("I\u0307".toLocaleLowerCase("tr")).toBe("i");
+
+ expect("\u012e".toLocaleLowerCase()).toBe("\u012f");
+ expect("\u012e".toLocaleLowerCase("lt")).toBe("\u012f");
+
+ expect("\u012e\u0300".toLocaleLowerCase()).toBe("\u012f\u0300");
+ expect("\u012e\u0300".toLocaleLowerCase("lt")).toBe("\u012f\u0307\u0300");
+
+ expect("\u012e\u0300".toLocaleLowerCase(["en", "lt"])).toBe("\u012f\u0300");
+ expect("\u012e\u0300".toLocaleLowerCase(["lt", "en"])).toBe("\u012f\u0307\u0300");
});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleUpperCase.js b/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleUpperCase.js
index ec70301b74..39e992df6e 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleUpperCase.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/String/String.prototype.toLocaleUpperCase.js
@@ -27,4 +27,19 @@ test("special case folding", () => {
expect("\u1FB7".toLocaleUpperCase()).toBe("\u0391\u0342\u0399");
expect("\u1FC7".toLocaleUpperCase()).toBe("\u0397\u0342\u0399");
expect("\u1FF7".toLocaleUpperCase()).toBe("\u03A9\u0342\u0399");
+
+ expect("i".toLocaleUpperCase()).toBe("I");
+ expect("i".toLocaleUpperCase("lt")).toBe("I");
+
+ expect("i\u0307".toLocaleUpperCase()).toBe("I\u0307");
+ expect("i\u0307".toLocaleUpperCase("lt")).toBe("I");
+
+ expect("j".toLocaleUpperCase()).toBe("J");
+ expect("j".toLocaleUpperCase("lt")).toBe("J");
+
+ expect("j\u0307".toLocaleUpperCase()).toBe("J\u0307");
+ expect("j\u0307".toLocaleUpperCase("lt")).toBe("J");
+
+ expect("j\u0307".toLocaleUpperCase(["en", "lt"])).toBe("J\u0307");
+ expect("j\u0307".toLocaleUpperCase(["lt", "en"])).toBe("J");
});