diff options
author | Vladimír Čunát <v@cunat.cz> | 2020-10-19 21:39:13 +0200 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2020-10-19 21:46:08 +0200 |
commit | a76152ac6eda0a9a918039401a81fc3e7ff8ee88 (patch) | |
tree | dfbd91dd89303898bd5821a30fe148caca487330 /pkgs/pkgs-lib | |
parent | 298659b5f8a8e266260ecb576fe47ad2bb8e63da (diff) |
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.
Diffstat (limited to 'pkgs/pkgs-lib')
-rw-r--r-- | pkgs/pkgs-lib/tests/formats.nix | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix index 3e52f74989d2..16b760a5ada1 100644 --- a/pkgs/pkgs-lib/tests/formats.nix +++ b/pkgs/pkgs-lib/tests/formats.nix @@ -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 ''; |