Skip to content

Commit 89d44c0

Browse files
committed
test: add a case of 'general newilne' AKA \R syntax
Checking support for multiple \R, the "general newline" shorthand https://github.com/kkos/oniguruma/blob/3bbb3d65c65350bfd941129592cb390aadedb25a/doc/SYNTAX.md#23-onig_syn_op2_esc_capital_r_general_newline-enable-r
1 parent 75074c9 commit 89d44c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

regex_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,15 @@ var findTests = []FindTest{
606606
20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
607607
30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36),
608608
},
609+
610+
// https://github.com/kkos/oniguruma/blob/2a25d8c2c4699c57f4d456ccd13149c0c714723d/test/test_back.c#LL629C1-L631C25
611+
{"\\R", "\r\n", build(1, 0, 2)},
612+
{"\\R", "\r", build(1, 0, 1)},
613+
{"\\R", "\n", build(1, 0, 1)},
614+
615+
{`b\R.*\R`, "ab\nc\n", build(1, 1, 5)},
616+
// equivalent, from Linguist dataset
617+
{`^\s*BEGIN\R\s*.*\R`, "\tBEGIN\n\tMultiUse = -1 'True\n", build(1, 0, 29)},
609618
}
610619

611620
// build is a helper to construct a [][]int by extracting n sequences from x.

0 commit comments

Comments
 (0)