mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
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
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
Add a link
Reference in a new issue