From a759afc99fab3a9cc407f931a074737617dd5b2d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 3 Oct 2026 09:11:00 +0200 Subject: [PATCH] Fix CI: no semicolon after CAPTURE() in the #3989 tests #5737 enabled -Wextra-semi-stmt for the tests and removed the semicolons after CAPTURE(), which expands to a complete statement; the #3989 tests added twelve more. Signed-off-by: Niels Lohmann --- tests/src/unit-class_parser.cpp | 12 ++++++------ tests/src/unit-regression2.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/src/unit-class_parser.cpp b/tests/src/unit-class_parser.cpp index b9a0ca844..33ed12acd 100644 --- a/tests/src/unit-class_parser.cpp +++ b/tests/src/unit-class_parser.cpp @@ -3234,7 +3234,7 @@ TEST_CASE("parser error recovery (#3989)") for (const auto& repair : repairs) { - CAPTURE(repair.input); + CAPTURE(repair.input) const auto result = parse_recovering(std::string(repair.input)); CHECK(!result.ok); CHECK(result.balanced); @@ -3269,7 +3269,7 @@ TEST_CASE("parser error recovery (#3989)") "", " ", "]", "tru", "NaN", ",:", "/* comment" }) { - CAPTURE(s); + CAPTURE(s) const auto result = parse_recovering(s, true, true); CHECK(!result.ok); CHECK(result.balanced); @@ -3288,7 +3288,7 @@ TEST_CASE("parser error recovery (#3989)") R"(["a\qb"])", "[1e999]", "{1:2}", R"({"a":[1,2}})", "[1,", "[1] [2]", "{a:1}" }) { - CAPTURE(s); + CAPTURE(s) const auto result = parse_recovering(s); REQUIRE(!result.errors.empty()); json _; @@ -3335,7 +3335,7 @@ TEST_CASE("parser error recovery (#3989)") "[1,]", R"({"a":1,})", "[[1,],]" }) { - CAPTURE(s); + CAPTURE(s) const auto result = parse_recovering(s, true, false, true); CHECK(result.ok); CHECK(result.errors.empty()); @@ -3429,7 +3429,7 @@ TEST_CASE("parser error recovery (#3989)") "[1 2]", "[tru}, 1]", R"({"a" "b\q", "c":[1.x, 2}})", "[\"\xFF\xC3(\", -, 1e+]", "{a:1,\"b\":2", ")]}' [1]" }) { - CAPTURE(s); + CAPTURE(s) const auto reference = parse_recovering(s); CHECK(reference.balanced); @@ -3500,7 +3500,7 @@ TEST_CASE("parser error recovery (#3989)") for (const auto& s : inputs) { - CAPTURE(s); + CAPTURE(s) const auto result = parse_recovering(s); CHECK(result.balanced); CHECK(result.errors.size() <= s.size() + 1); diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp index e72889d7c..b4a3f2659 100644 --- a/tests/src/unit-regression2.cpp +++ b/tests/src/unit-regression2.cpp @@ -1154,12 +1154,12 @@ TEST_CASE("regression test - #3989 SAX parse_error() returning true") { const auto format = encoding.first; const auto& bytes = encoding.second; - CAPTURE(format); + CAPTURE(format) // every prefix is truncated input for (std::size_t length = 0; length < bytes.size(); ++length) { - CAPTURE(length); + CAPTURE(length) const auto result = parse_binary_recovering(std::vector(bytes.begin(), bytes.begin() + static_cast(length)), format); CHECK(!result.ok); CHECK(result.errors == 1); @@ -1306,8 +1306,8 @@ TEST_CASE("regression test - #3989 SAX parse_error() returning true") for (const auto& repair : repairs) { - CAPTURE(repair.format); - CAPTURE(repair.input); + CAPTURE(repair.format) + CAPTURE(repair.input) const auto result = parse_binary_recovering(repair.input, repair.format); CHECK(!result.ok); CHECK(result.balanced); @@ -1390,7 +1390,7 @@ TEST_CASE("regression test - #3989 SAX parse_error() returning true") { const auto format = encoding.first; const auto& original = encoding.second; - CAPTURE(format); + CAPTURE(format) std::vector> inputs; for (std::size_t position = 0; position < original.size(); ++position) @@ -1408,7 +1408,7 @@ TEST_CASE("regression test - #3989 SAX parse_error() returning true") for (const auto& input : inputs) { - CAPTURE(input); + CAPTURE(input) const auto result = parse_binary_recovering(input, format); CHECK(result.balanced); CHECK(result.errors <= input.size() + 1);