mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
Add error message if test suite cannot be found (#3585)
* 🚸 add error message if test suite cannot be found Fixes #3584
This commit is contained in:
22
tests/src/make_test_data_available.hpp
Normal file
22
tests/src/make_test_data_available.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdio> // fopen, fclose, FILE
|
||||
#include <memory> // unique_ptr
|
||||
#include <test_data.hpp>
|
||||
#include <doctest.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
|
||||
inline bool check_testsuite_downloaded()
|
||||
{
|
||||
std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), &std::fclose);
|
||||
return file != nullptr;
|
||||
}
|
||||
|
||||
TEST_CASE("check test suite is downloaded")
|
||||
{
|
||||
REQUIRE_MESSAGE(utils::check_testsuite_downloaded(), "Test data not found in '" TEST_DATA_DIRECTORY "'. Please execute target 'download_test_data' before running this test suite. See <https://github.com/nlohmann/json#execute-unit-tests> for more information.");
|
||||
}
|
||||
|
||||
} // namespace utils
|
@ -12,7 +12,7 @@
|
||||
using nlohmann::json;
|
||||
|
||||
#include <fstream>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
TEST_CASE("Binary Formats" * doctest::skip())
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ using nlohmann::json;
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -13,7 +13,7 @@ using nlohmann::json;
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
TEST_CASE("BSON")
|
||||
|
@ -16,7 +16,7 @@ using nlohmann::json;
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -13,7 +13,7 @@ using nlohmann::json;
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
TEST_CASE("object inspection")
|
||||
{
|
||||
|
@ -12,7 +12,7 @@
|
||||
using nlohmann::json;
|
||||
|
||||
#include <fstream>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
TEST_CASE("JSON patch")
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -19,7 +19,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
#include <cstdio>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#include <variant>
|
||||
|
@ -12,7 +12,7 @@
|
||||
using nlohmann::json;
|
||||
|
||||
#include <fstream>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
TEST_CASE("compliance tests from json.org")
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ using nlohmann::json;
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -16,7 +16,7 @@ using nlohmann::json;
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
TEST_CASE("Unicode (1/5)" * doctest::skip())
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
// this test suite uses static variables with non-trivial destructors
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
|
@ -18,7 +18,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
// this test suite uses static variables with non-trivial destructors
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
|
@ -18,7 +18,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
// this test suite uses static variables with non-trivial destructors
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
|
@ -18,7 +18,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <test_data.hpp>
|
||||
#include "make_test_data_available.hpp"
|
||||
|
||||
// this test suite uses static variables with non-trivial destructors
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
|
Reference in New Issue
Block a user