Skip to content

Commit

Permalink
Add some additional tests for unicode escapes in capture group names
Browse files Browse the repository at this point in the history
  • Loading branch information
ridiculousfish committed Aug 19, 2023
1 parent 4026d98 commit f25d5dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,12 @@ fn run_regexp_named_capture_groups_tc(tc: TestConfig) {

// regression test for
// https://github.com/ridiculousfish/regress/issues/41
tc.compilef(r#"(?<au>.)"#, "").match1_named_group("a", "au").test_eq("a");
tc.compilef(r#"(?<u>.)"#, "").match1_named_group("xxx", "u").test_eq("x");
tc.compilef(r#"(?<au>.)"#, "").match1_named_group("xxx", "au").test_eq("x");
tc.compilef(r#"(?<aau>.)"#, "").match1_named_group("xxx", "aau").test_eq("x");

// Escapes are valid in group names.
tc.compilef(r#"(?<\u0041\u0042>c+)"#, "").match1_named_group("aabbccddeeff", "AB").test_eq("cc");

// Make sure that escapes are parsed correctly in the fast capture group parser.
// This pattern should fail in unicode mode, because there is a backreference without a capture group.
Expand Down

0 comments on commit f25d5dd

Please sign in to comment.