Skip to content

Commit

Permalink
Fix test reporting when in interactive mode.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jfdm authored and gallais committed Jun 10, 2020
1 parent b88f425 commit 90fb901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/Main.idr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90fb901

Please sign in to comment.