From a76152ac6eda0a9a918039401a81fc3e7ff8ee88 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Mon, 19 Oct 2020 21:39:13 +0200 Subject: 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. --- pkgs/pkgs-lib/tests/formats.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix index 3e52f74989d27..16b760a5ada14 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 ''; -- cgit 1.4.1