mirror of
https://github.com/nlohmann/json.git
synced 2026-11-05 04:09:22 +00:00
Tests: skip the parse() allocation sweep with MSVC iterator debugging
With _ITERATOR_DEBUG_LEVEL > 0 (MSVC STL debug builds, clang-cl), containers allocate inside noexcept functions, so a failing allocation terminates the program: "test case CRASHED: Terminate handler called" in the sax_parse subcase of #5985. The sweep test of #6000 has the same guard. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+4
-1
@@ -1026,7 +1026,10 @@ TEST_CASE("insert() provides its documented exception guarantees (#5986)")
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(JSON_NOEXCEPTION)
|
// the no-exceptions CI job has no std::bad_alloc to catch; with iterator
|
||||||
|
// debugging (MSVC STL debug builds) containers allocate inside noexcept
|
||||||
|
// functions, so failing an allocation there terminates the program
|
||||||
|
#if !defined(JSON_NOEXCEPTION) && !(defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0)
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// the allocation numbered sweep_fail_at (counted from 1) throws; 0 never fails
|
// the allocation numbered sweep_fail_at (counted from 1) throws; 0 never fails
|
||||||
|
|||||||
Reference in new issue
Block a user