Skip the exception-only checks of the stream input tests without exceptions

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-17 08:29:47 +02:00
1 parent c7a9780936
commit f25c6543aa
2 files changed
+9

No files matched your search

+3
View File
@@ -170,6 +170,7 @@ TEST_CASE("parsing from a FILE*")
check_unlocked(f.get());
}
#if !defined(JSON_NOEXCEPTION)
SECTION("the file is unlocked after a parse error")
{
const file_ptr f = open_with(name, "[1, 2, x]");
@@ -186,6 +187,8 @@ TEST_CASE("parsing from a FILE*")
CHECK(std::string(rest.data()) == "]");
}
#endif // !defined(JSON_NOEXCEPTION)
SECTION("the file can be parsed again and read with stdio afterwards")
{
const file_ptr f = open_with(name, "[1] [2] tail");
+6
View File
@@ -190,6 +190,7 @@ std::vector<std::string> corpus()
TEST_CASE("parsing from a std::istream scans the get area in bulk")
{
#if !defined(JSON_NOEXCEPTION)
SECTION("results do not depend on the get area")
{
const std::vector<read_mode> read_modes = {read_mode::extract, read_mode::parse, read_mode::parse_lenient};
@@ -210,6 +211,8 @@ TEST_CASE("parsing from a std::istream scans the get area in bulk")
}
}
#endif // !defined(JSON_NOEXCEPTION)
SECTION("values are the same as when parsing from a string")
{
const std::string input = R"({"name": "nlohmann::json", "numbers": [1, -2, 3.5, 4e10, 18446744073709551615],)"
@@ -227,6 +230,7 @@ TEST_CASE("parsing from a std::istream scans the get area in bulk")
CHECK(json::parse(ss) == expected);
}
#if !defined(JSON_NOEXCEPTION)
SECTION("a token that spans several get areas is reported completely")
{
// the error is found after the string has crossed many get areas; the
@@ -281,6 +285,8 @@ TEST_CASE("parsing from a std::istream scans the get area in bulk")
}
}
#endif // !defined(JSON_NOEXCEPTION)
SECTION("many values from one stream")
{
std::string input;