writers/test: Refactor

It now also checks the executable bit.
This commit is contained in:
Robert Hensing 2023-10-24 11:16:34 +02:00
parent e64f987fd6
commit a6622bf00a

View File

@ -7,6 +7,7 @@
, python3Packages , python3Packages
, pypy3Packages , pypy3Packages
, runCommand , runCommand
, testers
, writers , writers
, writeText , writeText
}: }:
@ -36,14 +37,7 @@ let
let let
expectedFile = writeText "${file.name}-expected" expected; expectedFile = writeText "${file.name}-expected" expected;
in in
runCommand "run-${file.name}" {} '' testers.testEqualContents { expected = expectedFile; actual = file; assertion = "${file.name} matches"; };
if ! diff -u ${file} ${expectedFile}; then
echo 'test ${file.name} failed'
exit 1
fi
touch $out
'';
in in
lib.recurseIntoAttrs { lib.recurseIntoAttrs {
bin = lib.recurseIntoAttrs { bin = lib.recurseIntoAttrs {