From ec0e53dc6711aeb827eccd65b6f0779aa841aad2 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 2 Jan 2024 10:08:16 +1100 Subject: Fix warnings in test case code mostly by adding const. --- test/unit/testRESearch.cxx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'test/unit/testRESearch.cxx') diff --git a/test/unit/testRESearch.cxx b/test/unit/testRESearch.cxx index 1902fdb2b..120bbdf15 100644 --- a/test/unit/testRESearch.cxx +++ b/test/unit/testRESearch.cxx @@ -35,6 +35,7 @@ class StringCI : public CharacterIndexer { public: StringCI(std::string_view sv_) : s(sv_) { } + virtual ~StringCI() = default; Sci::Position Length() const noexcept { return s.length(); } @@ -58,38 +59,38 @@ TEST_CASE("RESearch") { constexpr std::string_view pattern = "[a-z]+"; SECTION("Compile") { - std::unique_ptr re = std::make_unique(&cc); - const char *msg = re->Compile(pattern.data(), pattern.length(), true, false); + RESearch re(&cc); + const char *msg = re.Compile(pattern.data(), pattern.length(), true, false); REQUIRE(nullptr == msg); } SECTION("Bug2413") { // Check for https://sourceforge.net/p/scintilla/bugs/2413/ - std::unique_ptr re = std::make_unique(&cc); + RESearch re(&cc); constexpr std::string_view BOW = "\\<"; constexpr std::string_view EOW = "\\>"; - const char *msg = re->Compile(BOW.data(), BOW.length(), true, false); + const char *msg = re.Compile(BOW.data(), BOW.length(), true, false); REQUIRE(nullptr == msg); - msg = re->Compile(EOW.data(), EOW.length(), true, false); + msg = re.Compile(EOW.data(), EOW.length(), true, false); REQUIRE(nullptr == msg); } SECTION("Execute") { - std::unique_ptr re = std::make_unique(&cc); - re->Compile(pattern.data(), pattern.length(), true, false); + RESearch re(&cc); + re.Compile(pattern.data(), pattern.length(), true, false); StringCI sci(sTextSpace); - const int x = re->Execute(sci, 0, sci.Length()); + const int x = re.Execute(sci, 0, sci.Length()); REQUIRE(x == 1); - REQUIRE(re->bopat[0] == 1); - REQUIRE(re->eopat[0] == sci.Length() - 1); + REQUIRE(re.bopat[0] == 1); + REQUIRE(re.eopat[0] == sci.Length() - 1); } SECTION("Grab") { - std::unique_ptr re = std::make_unique(&cc); - re->Compile(pattern.data(), pattern.length(), true, false); + RESearch re(&cc); + re.Compile(pattern.data(), pattern.length(), true, false); StringCI sci(sTextSpace); - re->Execute(sci, 0, sci.Length()); - std::string pat = sci.GetCharRange(re->bopat[0], re->eopat[0] - re->bopat[0]); + re.Execute(sci, 0, sci.Length()); + std::string pat = sci.GetCharRange(re.bopat[0], re.eopat[0] - re.bopat[0]); REQUIRE(pat == "cintilla"); } -- cgit v1.2.3