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