mirror of
https://github.com/nlohmann/json.git
synced 2025-08-13 14:42:28 +03:00
🏗️ adding anonymous namespace
This commit is contained in:
@@ -34,8 +34,9 @@ SOFTWARE.
|
||||
using nlohmann::json;
|
||||
#undef private
|
||||
|
||||
namespace
|
||||
{
|
||||
// special test case to check if memory is leaked if constructor throws
|
||||
|
||||
template<class T>
|
||||
struct bad_allocator : std::allocator<T>
|
||||
{
|
||||
@@ -45,6 +46,7 @@ struct bad_allocator : std::allocator<T>
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("bad_alloc")
|
||||
{
|
||||
@@ -65,6 +67,8 @@ TEST_CASE("bad_alloc")
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
static bool next_construct_fails = false;
|
||||
static bool next_destroy_fails = false;
|
||||
static bool next_deallocate_fails = false;
|
||||
@@ -130,6 +134,7 @@ void my_allocator_clean_up(T* p)
|
||||
alloc.destroy(p);
|
||||
alloc.deallocate(p, 1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("controlled bad_alloc")
|
||||
{
|
||||
|
Reference in New Issue
Block a user