Skip to content

Commit

Permalink
test: add a case of 'general newilne' AKA \R syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bzz committed May 21, 2023
1 parent 75074c9 commit 89d44c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,15 @@ var findTests = []FindTest{
20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36),
},

// https://github.com/kkos/oniguruma/blob/2a25d8c2c4699c57f4d456ccd13149c0c714723d/test/test_back.c#LL629C1-L631C25
{"\\R", "\r\n", build(1, 0, 2)},
{"\\R", "\r", build(1, 0, 1)},
{"\\R", "\n", build(1, 0, 1)},

{`b\R.*\R`, "ab\nc\n", build(1, 1, 5)},
// equivalent, from Linguist dataset
{`^\s*BEGIN\R\s*.*\R`, "\tBEGIN\n\tMultiUse = -1 'True\n", build(1, 0, 29)},
}

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

0 comments on commit 89d44c0

Please sign in to comment.