From 90fb901c8ff6328473319157e154460e3b9ce009 Mon Sep 17 00:00:00 2001 From: Jan de Muijnck-Hughes Date: Fri, 5 Jun 2020 13:29:46 +0100 Subject: [PATCH] Fix test reporting when in interactive mode. When runing in interactive mode, the diff between expected and output is not being show, Supposedly, Git-diff returns 0 on successful run and a non-zero for error. However, this is not being picked up by the test suite. We change git-diff's error reporting to be more diff like in which: + +ve indicates that there is a diff. + 0 indicates the files are the same. + -ve program error. This should make diff reporting more robust. --- tests/Main.idr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Main.idr b/tests/Main.idr index f8cdc67037..8c96eee718 100644 --- a/tests/Main.idr +++ b/tests/Main.idr @@ -199,8 +199,8 @@ runTest opts testPath ] Just exp => do putStrLn "Golden value differs from actual value." - code <- system "git diff expected output" - when (code /= 0) $ printExpectedVsOutput exp out + code <- system "git diff --exit-code expected output" + when (code < 0) $ printExpectedVsOutput exp out putStrLn "Accept actual value as new golden value? [yn]" b <- getAnswer when b $ do Right _ <- writeFile "expected" out