diff options
author | Neil <nyamatongwe@gmail.com> | 2024-01-02 10:08:16 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2024-01-02 10:08:16 +1100 |
commit | ec0e53dc6711aeb827eccd65b6f0779aa841aad2 (patch) | |
tree | 4cba13cd182aac11f6240cd8520e5b46a0d329bf /test/unit/testRESearch.cxx | |
parent | dac59d7a985cd4b42096848c02dcc26b55165493 (diff) | |
download | scintilla-mirror-ec0e53dc6711aeb827eccd65b6f0779aa841aad2.tar.gz |
Fix warnings in test case code mostly by adding const.
Diffstat (limited to 'test/unit/testRESearch.cxx')
-rw-r--r-- | test/unit/testRESearch.cxx | 29 |
1 files changed, 15 insertions, 14 deletions
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<RESearch> re = std::make_unique<RESearch>(&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<RESearch> re = std::make_unique<RESearch>(&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<RESearch> re = std::make_unique<RESearch>(&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<RESearch> re = std::make_unique<RESearch>(&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"); } |