mirror of
https://github.com/nlohmann/json.git
synced 2026-08-20 16:13:19 +00:00
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>
This commit is contained in:
@@ -350,9 +350,8 @@ TEST_CASE("lexer number fast path")
|
||||
|
||||
// the column must be the one the offending token actually starts at,
|
||||
// not the 0 that an unget() across the newline used to leave behind
|
||||
CHECK_THROWS_WITH_AS(json::parse("[01\n]"),
|
||||
"[json.exception.parse_error.101] parse error at line 1, column 3: "
|
||||
"syntax error while parsing array - unexpected number literal; expected ']'",
|
||||
json::parse_error&);
|
||||
CHECK(contiguous_error("[01\n]") ==
|
||||
"[json.exception.parse_error.101] parse error at line 1, column 3: "
|
||||
"syntax error while parsing array - unexpected number literal; expected ']'");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user