From 81b1bf6c265f77dd38901f76cdb4c97b3e85fd79 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 20 Apr 2018 08:51:26 +1000 Subject: Backport: Feature [feature-requests:#1215]. Fix forwarding reference warnings. Backport of changeset 6711:8d202ec5a734. --- test/unit/testSparseVector.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx index ac60d3421..ce3b9706b 100644 --- a/test/unit/testSparseVector.cxx +++ b/test/unit/testSparseVector.cxx @@ -233,4 +233,20 @@ TEST_CASE("SparseTextString") { REQUIRE("" == st.ValueAt(2)); st.Check(); } + + SECTION("SetAndMoveString") { + st.InsertSpace(0, 2); + REQUIRE(2u == st.Length()); + std::string s24("24"); + st.SetValueAt(0, s24); + REQUIRE("24" == s24); // Not moved from + REQUIRE("" == st.ValueAt(-1)); + REQUIRE("24" == st.ValueAt(0)); + REQUIRE("" == st.ValueAt(1)); + std::string s25("25"); + st.SetValueAt(1, std::move(s25)); + REQUIRE("" == s25); // moved from + REQUIRE("25" == st.ValueAt(1)); + } + } -- cgit v1.2.3