mirror of
https://github.com/nlohmann/json.git
synced 2025-06-13 03:42:37 +08:00
tests: Fix ignored attributes warning during build (#4670)
Signed-off-by: Gianfranco Costamagna <locutusofborg@debian.org> Co-authored-by: Pragyansh Chaturvedi <pragyansh.chaturvedi@gmail.com>
This commit is contained in:
parent
b477d2b95e
commit
cd92c09c18
@ -18,7 +18,8 @@ namespace utils
|
||||
|
||||
inline bool check_testsuite_downloaded()
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), &std::fclose);
|
||||
using FilePtr = std::unique_ptr<FILE, int(*)(FILE*)>;
|
||||
const FilePtr file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), std::fclose);
|
||||
return file != nullptr;
|
||||
}
|
||||
|
||||
|
@ -326,6 +326,7 @@ TEST_CASE("test suite from json-test-suite")
|
||||
TEST_CASE("json.org examples")
|
||||
{
|
||||
// here, we list all JSON values from https://json.org/example
|
||||
using FilePtr = std::unique_ptr<FILE, int(*)(FILE*)>;
|
||||
|
||||
SECTION("1.json")
|
||||
{
|
||||
@ -363,35 +364,35 @@ TEST_CASE("json.org examples")
|
||||
}
|
||||
SECTION("FILE 1.json")
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen(TEST_DATA_DIRECTORY "/json.org/1.json", "r"), &std::fclose);
|
||||
const FilePtr f(std::fopen(TEST_DATA_DIRECTORY "/json.org/1.json", "r"), &std::fclose);
|
||||
json _;
|
||||
CHECK_NOTHROW(_ = json::parse(f.get()));
|
||||
}
|
||||
|
||||
SECTION("FILE 2.json")
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen(TEST_DATA_DIRECTORY "/json.org/2.json", "r"), &std::fclose);
|
||||
const FilePtr f(std::fopen(TEST_DATA_DIRECTORY "/json.org/2.json", "r"), &std::fclose);
|
||||
json _;
|
||||
CHECK_NOTHROW(_ = json::parse(f.get()));
|
||||
}
|
||||
|
||||
SECTION("FILE 3.json")
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen(TEST_DATA_DIRECTORY "/json.org/3.json", "r"), &std::fclose);
|
||||
const FilePtr f(std::fopen(TEST_DATA_DIRECTORY "/json.org/3.json", "r"), &std::fclose);
|
||||
json _;
|
||||
CHECK_NOTHROW(_ = json::parse(f.get()));
|
||||
}
|
||||
|
||||
SECTION("FILE 4.json")
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen(TEST_DATA_DIRECTORY "/json.org/4.json", "r"), &std::fclose);
|
||||
const FilePtr f(std::fopen(TEST_DATA_DIRECTORY "/json.org/4.json", "r"), &std::fclose);
|
||||
json _;
|
||||
CHECK_NOTHROW(_ = json::parse(f.get()));
|
||||
}
|
||||
|
||||
SECTION("FILE 5.json")
|
||||
{
|
||||
const std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen(TEST_DATA_DIRECTORY "/json.org/5.json", "r"), &std::fclose);
|
||||
const FilePtr f(std::fopen(TEST_DATA_DIRECTORY "/json.org/5.json", "r"), &std::fclose);
|
||||
json _;
|
||||
CHECK_NOTHROW(_ = json::parse(f.get()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user