mirror of
https://github.com/nlohmann/json.git
synced 2024-11-28 00:59:02 +08:00
✅ add regression test
This commit is contained in:
parent
c9c5c016a2
commit
db98073930
@ -594,4 +594,30 @@ TEST_CASE("regression tests 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("issue #2865 - ASAN detects memory leaks")
|
||||
{
|
||||
// the code below is expected to not leak memory
|
||||
{
|
||||
nlohmann::json o;
|
||||
std::string s = "bar";
|
||||
|
||||
nlohmann::to_json(o["foo"], s);
|
||||
|
||||
nlohmann::json p = o;
|
||||
|
||||
// call to_json with a non-null JSON value
|
||||
nlohmann::to_json(p["foo"], s);
|
||||
}
|
||||
|
||||
{
|
||||
nlohmann::json o;
|
||||
std::string s = "bar";
|
||||
|
||||
nlohmann::to_json(o["foo"], s);
|
||||
|
||||
// call to_json with a non-null JSON value
|
||||
nlohmann::to_json(o["foo"], s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user