testEqualContents
pkgs.testers.testEqualContents
Docs pulled from | This Revision | 43 minutes ago
or doc/build-helpers/testers.chapter.md
Noogle detected
Implementation
The following is the current implementation of this function.
testEqualContents = {
assertion,
actual,
expected,
}: runCommand "equal-contents-${lib.strings.toLower assertion}" {
inherit assertion actual expected;
nativeBuildInputs = [ diffoscopeMinimal ];
} ''
echo "Checking:"
printf '%s\n' "$assertion"
if ! diffoscope --no-progress --text-color=always --exclude-directory-metadata=no -- "$actual" "$expected"
then
echo
echo 'Contents must be equal, but were not!'
echo
echo "+: expected, at $expected"
echo "-: unexpected, at $actual"
false
else
echo "expected $expected and actual $actual match."
echo OK
touch -- "$out"
fi
'';