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:
Niels Lohmann authored and GitHub committed 2022-07-20 12:41:33 +02:00
1 parent 527da54dcb
commit feef0eb595
17 files changed
+53 -15

No files matched your search

+22
View 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