mirror of
https://github.com/nlohmann/json.git
synced 2026-09-27 10:10:29 +00:00
Skip the failed-allocation test when exceptions are disabled
The no-exceptions CI job runs doctest with --no-throw, which skips every CHECK_THROWS_AS. The test then left next_construct_fails set, and the next allocation outside a check threw std::bad_alloc. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -389,6 +389,9 @@ TEST_CASE("bad my_allocator::construct")
|
||||
}
|
||||
}
|
||||
|
||||
// the no-exceptions CI job skips every CHECK_THROWS_AS, which would leave
|
||||
// next_construct_fails set for the next allocation outside a check
|
||||
#if !defined(JSON_NOEXCEPTION)
|
||||
TEST_CASE("a failed allocation leaves the value unchanged")
|
||||
{
|
||||
// create JSON type using the throwing allocator
|
||||
@@ -501,3 +504,4 @@ TEST_CASE("a failed allocation leaves the value unchanged")
|
||||
CHECK(j == my_json({1, 2}));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user