Don't use std::invocable C++ concept yet

It s not supported on all platforms yet. Can revert this once it is.
This commit is contained in:
John Ericson 2023-11-01 16:11:20 -04:00
parent b107431816
commit d15c3a33e6
2 changed files with 6 additions and 10 deletions

View file

@ -87,7 +87,7 @@ TEST_F(DynDerivationTest, BadATerm_oldVersionDynDeps) {
} \ } \
\ \
TEST_F(FIXTURE, DerivationOutput_ ## NAME ## _to_json) { \ TEST_F(FIXTURE, DerivationOutput_ ## NAME ## _to_json) { \
writeTest<json>("output-" #NAME ".json", [&]() -> json { \ writeTest("output-" #NAME ".json", [&]() -> json { \
return DerivationOutput { (VAL) }.toJSON( \ return DerivationOutput { (VAL) }.toJSON( \
*store, \ *store, \
(DRV_NAME), \ (DRV_NAME), \
@ -165,7 +165,7 @@ TEST_JSON(ImpureDerivationTest, impure,
} \ } \
\ \
TEST_F(FIXTURE, Derivation_ ## NAME ## _to_json) { \ TEST_F(FIXTURE, Derivation_ ## NAME ## _to_json) { \
writeTest<json>(#NAME ".json", [&]() -> json { \ writeTest(#NAME ".json", [&]() -> json { \
return Derivation { VAL }.toJSON(*store); \ return Derivation { VAL }.toJSON(*store); \
}, [](const auto & file) { \ }, [](const auto & file) { \
return json::parse(readFile(file)); \ return json::parse(readFile(file)); \

View file

@ -66,16 +66,12 @@ public:
* @param test hook that produces contents of the file and does the * @param test hook that produces contents of the file and does the
* actual work * actual work
*/ */
template<typename T>
void writeTest( void writeTest(
PathView testStem, PathView testStem, auto && test, auto && readFile2, auto && writeFile2)
std::invocable<> auto && test,
std::invocable<const Path &> auto && readFile2,
std::invocable<const Path &, const T &> auto && writeFile2)
{ {
auto file = goldenMaster(testStem); auto file = goldenMaster(testStem);
T got = test(); auto got = test();
if (testAccept()) if (testAccept())
{ {
@ -87,7 +83,7 @@ public:
} }
else else
{ {
T expected = readFile2(file); decltype(got) expected = readFile2(file);
ASSERT_EQ(got, expected); ASSERT_EQ(got, expected);
} }
} }
@ -97,7 +93,7 @@ public:
*/ */
void writeTest(PathView testStem, auto && test) void writeTest(PathView testStem, auto && test)
{ {
writeTest<std::string>( writeTest(
testStem, test, testStem, test,
[](const Path & f) -> std::string { [](const Path & f) -> std::string {
return readFile(f); return readFile(f);