4#include <gtest/gtest.h>
16static inline std::filesystem::path getUnitTestData() {
17 return getEnv(
"_NIX_TEST_UNIT_DATA").value();
25static inline bool testAccept() {
26 return getEnv(
"_NIX_TEST_ACCEPT") ==
"1";
39 virtual std::filesystem::path
goldenMaster(PathView testStem)
const = 0;
55 <<
"Cannot read golden master "
57 <<
"because another test is also updating it";
72 PathView testStem,
auto && test,
auto && readFile2,
auto && writeFile2)
80 std::filesystem::create_directories(file.parent_path());
81 writeFile2(file, got);
83 <<
"Updating golden master "
88 decltype(got) expected = readFile2(file);
89 ASSERT_EQ(got, expected);
100 [](
const std::filesystem::path &
f) -> std::string {
103 [](
const std::filesystem::path &
f,
const std::string & c) {
104 return writeFile(
f, c);
Definition characterization.hh:33
void writeTest(PathView testStem, auto &&test)
Definition characterization.hh:96
void writeTest(PathView testStem, auto &&test, auto &&readFile2, auto &&writeFile2)
Definition characterization.hh:71
virtual std::filesystem::path goldenMaster(PathView testStem) const =0
void readTest(PathView testStem, auto &&test)
Definition characterization.hh:48
std::string readFile() const