LibJS: Add tests for Unicode property escapes
LibJS gets this for free from LibRegex, but let's add test cases for it.
This commit is contained in:
parent
d485cf29d7
commit
b3569fab7c
Notes:
sideshowbarker
2024-07-18 07:43:27 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/b3569fab7cf Pull-request: https://github.com/SerenityOS/serenity/pull/9090 Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/davidot Reviewed-by: https://github.com/linusg
1 changed files with 12 additions and 0 deletions
|
@ -91,3 +91,15 @@ test("override exec with non-function", () => {
|
|||
re.exec = 3;
|
||||
expect(re.test("test")).toBe(true);
|
||||
});
|
||||
|
||||
test("property escapes", () => {
|
||||
expect(/\p{ASCII}/.test("a")).toBeFalse();
|
||||
expect(/\p{ASCII}/.test("p{ASCII}")).toBeTrue();
|
||||
expect(/\p{ASCII}/u.test("a")).toBeTrue();
|
||||
expect(/\p{ASCII}/u.test("😀")).toBeFalse();
|
||||
expect(/\p{ASCII_Hex_Digit}/u.test("1")).toBeTrue();
|
||||
expect(/\p{ASCII_Hex_Digit}/u.test("a")).toBeTrue();
|
||||
expect(/\p{ASCII_Hex_Digit}/u.test("x")).toBeFalse();
|
||||
expect(/\p{Any}/u.test("\u0378")).toBeTrue();
|
||||
expect(/\p{Assigned}/u.test("\u0378")).toBeFalse();
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue