forked from mirrors/nixpkgs
pkgs-lib/tests/formats: improve message on failure
Foremost, the message was discarding double quotes on one side of the diff, which was super-confusing to me, as I thought that the format convertor broke that when in fact only whitespace was changed. I thought I'd cat the files, but then... switching to `diff -u` seemed self-sufficient. It felt sufficiently non-controversial to push directly, but certainly feel free to improve further.
This commit is contained in:
parent
298659b5f8
commit
a76152ac6e
|
@ -15,11 +15,11 @@ let
|
|||
in formatSet.generate "test-format-file" config;
|
||||
|
||||
runBuildTest = name: { drv, expected }: pkgs.runCommandNoCC name {} ''
|
||||
if diff ${drv} ${builtins.toFile "expected" expected}; then
|
||||
touch $out
|
||||
if diff -u '${builtins.toFile "expected" expected}' '${drv}'; then
|
||||
touch "$out"
|
||||
else
|
||||
echo "Got: $(cat ${drv})"
|
||||
echo "Should be: ${expected}"
|
||||
echo
|
||||
echo "Got different values than expected; diff above."
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue