From 8c8c50a9f23e4060475e0dfb8e9971a93655b05f Mon Sep 17 00:00:00 2001 From: Gulliver Date: Tue, 4 Feb 2025 20:28:23 +0100 Subject: [PATCH] added testcase for requested samples from issue --- tests/unittest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/unittest.cpp b/tests/unittest.cpp index 454614292..5437275cd 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -1416,6 +1416,25 @@ TEST_CASE("json_list") CHECK("[5,6,7,8,4,3,2,1]" == x.dump()); } // json_list +static crow::json::wvalue getValue(int i){ + return crow::json::wvalue(i); +} + +TEST_CASE("json Incorrect move of wvalue class #953") +{ + { + crow::json::wvalue int_value(-500); + crow::json::wvalue copy_value(std::move(int_value)); + + REQUIRE(copy_value.dump()=="-500"); + } + { + crow::json::wvalue json; + json["int_value"] = getValue(-500); + REQUIRE(json["int_value"].dump()=="-500"); + } +} + TEST_CASE("template_basic") { auto t = crow::mustache::compile(R"---(attack of {{name}})---");