Fix pattern escaping in regex used for \R so it works when the x-modifier is in effect.

Fixes: https://svn.boost.org/trac10/ticket/12960
This commit is contained in:
jzmaddock
2017-08-03 18:04:41 +01:00
parent 5c543a8e2b
commit a32e0cc9d3
2 changed files with 13 additions and 6 deletions

View File

@ -155,12 +155,19 @@ void test_assertion_escapes()
TEST_REGEX_SEARCH("\\R", perl, "foo\nbar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH("\\R", perl, "foo\rbar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH("\\R", perl, "foo\r\nbar", match_default, make_array(3, 5, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\r\nbar", match_default, make_array(0, 5, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\x0A" "bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\x0B" "bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\x0C" "bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\x85" "bar", match_default, make_array(0, 4, -2, -2));
// see if \u works:
const wchar_t* w = L"\u2028";
if(*w == 0x2028u)
{
TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2028bar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2029bar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
}
}