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 <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-10-03 09:11:00 +02:00
parent 1143da4faa
commit a759afc99f
2 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -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);
+6 -6
View File
@@ -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<std::uint8_t>(bytes.begin(), bytes.begin() + static_cast<std::ptrdiff_t>(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<std::vector<std::uint8_t>> 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);