aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit
diff options
context:
space:
mode:
authorZufu Liu <unknown>2023-12-12 09:45:46 +1100
committerZufu Liu <unknown>2023-12-12 09:45:46 +1100
commit50f053ff0f1d1a2b45a20e65f25a21a2a10c1bc4 (patch)
tree6394af33566c632c73cf5f035abf5d176f61e946 /test/unit
parent1b83a38def5c210c39421593b0a73c23495bcd54 (diff)
downloadscintilla-mirror-50f053ff0f1d1a2b45a20e65f25a21a2a10c1bc4.tar.gz
Bug [#2405]. Fix regular expression assertion (^, $, \b. \B) failures when using
SCFIND_CXX11REGEX.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/testDocument.cxx37
1 files changed, 32 insertions, 5 deletions
diff --git a/test/unit/testDocument.cxx b/test/unit/testDocument.cxx
index ca95bda66..52af45167 100644
--- a/test/unit/testDocument.cxx
+++ b/test/unit/testDocument.cxx
@@ -555,6 +555,10 @@ TEST_CASE("Document") {
REQUIRE(match == Match(0));
match = doc.FindString(1, docLength, findingBOL, reCxx11);
REQUIRE(match == Match(10));
+ match = doc.FindString(docLength, 0, findingBOL, reCxx11);
+ REQUIRE(match == Match(10));
+ match = doc.FindString(docLength - 1, 0, findingBOL, reCxx11);
+ REQUIRE(match == Match(10));
#endif
constexpr std::string_view findingEOL = "$";
@@ -567,11 +571,15 @@ TEST_CASE("Document") {
match = doc.FindString(docLength - 1, 0, findingEOL, rePosix);
REQUIRE(match == Match(8));
- #ifndef NO_CXX11_REGEX
+ #if !defined(NO_CXX11_REGEX) && !defined(_LIBCPP_VERSION)
match = doc.FindString(0, docLength, findingEOL, reCxx11);
REQUIRE(match == Match(8));
match = doc.FindString(1, docLength, findingEOL, reCxx11);
REQUIRE(match == Match(8));
+ match = doc.FindString(docLength, 0, findingEOL, reCxx11);
+ REQUIRE(match == Match(18));
+ match = doc.FindString(docLength - 1, 0, findingEOL, reCxx11);
+ REQUIRE(match == Match(8));
#endif
constexpr std::string_view findingBOW = "\\<";
@@ -605,13 +613,32 @@ TEST_CASE("Document") {
match = doc.FindString(0, docLength, findingWB, reCxx11);
REQUIRE(match == Match(0));
match = doc.FindString(1, docLength, findingWB, reCxx11);
- REQUIRE(match == Match(1));
+ REQUIRE(match == Match(2));
+ match = doc.FindString(docLength, 0, findingWB, reCxx11);
+ #ifdef _LIBCPP_VERSION
+ REQUIRE(match == Match(16));
+ #else
+ REQUIRE(match == Match(18));
+ #endif
+ match = doc.FindString(docLength - 1, 0, findingWB, reCxx11);
+ REQUIRE(match == Match(16));
constexpr std::string_view findingNWB = "\\B";
match = doc.FindString(0, docLength, findingNWB, reCxx11);
REQUIRE(match == Match(1));
match = doc.FindString(1, docLength, findingNWB, reCxx11);
- REQUIRE(match == Match(4));
+ REQUIRE(match == Match(1));
+ #ifdef _LIBCPP_VERSION
+ match = doc.FindString(docLength, 0, findingNWB, reCxx11);
+ REQUIRE(match == Match(18));
+ match = doc.FindString(docLength - 1, 0, findingNWB, reCxx11);
+ REQUIRE(match == Match(14));
+ #else
+ match = doc.FindString(docLength, 0, findingNWB, reCxx11);
+ REQUIRE(match == Match(17));
+ match = doc.FindString(docLength - 1, 0, findingNWB, reCxx11);
+ REQUIRE(match == Match(17));
+ #endif
#endif
}
@@ -637,7 +664,7 @@ TEST_CASE("Document") {
match = doc.FindString(0, docLength, "\\b[a-z]", reCxx11);
REQUIRE(match == Match(0, 1));
match = doc.FindString(1, docLength, "\\b[a-z]", reCxx11);
- REQUIRE(match == Match(1, 1)); // Should be (3,1)
+ REQUIRE(match == Match(3, 1));
match = doc.FindString(0, docLength, "[a-z]\\b", reCxx11);
REQUIRE(match == Match(1, 1));
match = doc.FindString(2, docLength, "[a-z]\\b", reCxx11);
@@ -646,7 +673,7 @@ TEST_CASE("Document") {
match = doc.FindString(0, docLength, "\\B[a-z]", reCxx11);
REQUIRE(match == Match(1, 1));
match = doc.FindString(1, docLength, "\\B[a-z]", reCxx11);
- REQUIRE(match == Match(4, 1)); // Should be (1,1)
+ REQUIRE(match == Match(1, 1));
match = doc.FindString(0, docLength, "[a-z]\\B", reCxx11);
REQUIRE(match == Match(0, 1));
match = doc.FindString(2, docLength, "[a-z]\\B", reCxx11);