Skip to content

Commit 5232f77

Browse files
committed
Do not discard the parse result in the error position check
json::parse is declared warn_unused_result, and CHECK_THROWS_WITH_AS evaluates its expression as a discarded statement, so the assertion broke the -Werror builds (GCC -Werror=unused-result, MSVC C4834 under /WX). Compare against the helper that already captures the message instead. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
1 parent 509494e commit 5232f77

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tests/src/unit-class_lexer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,8 @@ TEST_CASE("lexer number fast path")
350350

351351
// the column must be the one the offending token actually starts at,
352352
// not the 0 that an unget() across the newline used to leave behind
353-
CHECK_THROWS_WITH_AS(json::parse("[01\n]"),
354-
"[json.exception.parse_error.101] parse error at line 1, column 3: "
355-
"syntax error while parsing array - unexpected number literal; expected ']'",
356-
json::parse_error&);
353+
CHECK(contiguous_error("[01\n]") ==
354+
"[json.exception.parse_error.101] parse error at line 1, column 3: "
355+
"syntax error while parsing array - unexpected number literal; expected ']'");
357356
}
358357
}

0 commit comments

Comments
 (0)