diff options
author | Neil <nyamatongwe@gmail.com> | 2024-01-30 10:11:10 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2024-01-30 10:11:10 +1100 |
commit | 77d00274b4e729ba5eac3cda390d6aa9478567ca (patch) | |
tree | 01744884872093ea9406a206e554f9d569a3b0d2 /test/unit/testSparseVector.cxx | |
parent | 72689db0d549c0cb850012546c71117ea74c2f2c (diff) | |
download | scintilla-mirror-77d00274b4e729ba5eac3cda390d6aa9478567ca.tar.gz |
Avoid warnings in unit tests with const, nullptr, [[nodiscard]], initialisation,
and unnamed namespace.
Diffstat (limited to 'test/unit/testSparseVector.cxx')
-rw-r--r-- | test/unit/testSparseVector.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx index 3a9ac3123..157acfc2d 100644 --- a/test/unit/testSparseVector.cxx +++ b/test/unit/testSparseVector.cxx @@ -39,13 +39,13 @@ TEST_CASE("CompileCopying SparseVector") { SparseVector<int> s2; // Copy constructor - SparseVector<int> sa(s); + const SparseVector<int> sa(s); // Copy assignment SparseVector<int> sb; sb = s; // Move constructor - SparseVector<int> sc(std::move(s)); + const SparseVector<int> sc(std::move(s)); // Move assignment SparseVector<int> sd; sd = (std::move(s2)); @@ -64,7 +64,7 @@ TEST_CASE("CompileCopying SparseVector") { #endif // Move constructor - SparseVector<UniqueInt> sc(std::move(s)); + const SparseVector<UniqueInt> sc(std::move(s)); // Move assignment SparseVector<UniqueInt> s2; SparseVector<UniqueInt> sd; @@ -73,9 +73,11 @@ TEST_CASE("CompileCopying SparseVector") { } +namespace { + // Helper to produce a string representation of a SparseVector<const char *> // to simplify checks. -static std::string Representation(const SparseVector<UniqueString> &st) { +std::string Representation(const SparseVector<UniqueString> &st) { std::string ret; for (int i = 0;i <= st.Length();i++) { const char *value = st.ValueAt(i).get(); @@ -87,6 +89,8 @@ static std::string Representation(const SparseVector<UniqueString> &st) { return ret; } +} + TEST_CASE("SparseVector") { SparseVector<UniqueString> st; @@ -473,7 +477,7 @@ TEST_CASE("SparseTextString") { SECTION("SetAndMoveString") { st.InsertSpace(0, 2); REQUIRE(2u == st.Length()); - std::string s24("24"); + const std::string s24("24"); st.SetValueAt(0, s24); REQUIRE("24" == s24); // Not moved from REQUIRE("" == st.ValueAt(-1)); |