mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-12-15 02:01:39 +03:00
When a test fails, print a suggestion how to make the output gold.
This commit is contained in:
parent
32fb511ced
commit
01b72ce0f9
@ -200,16 +200,24 @@ generateAssertion opts dir file = testCase file $ do
|
||||
Left (X.SomeException {})
|
||||
| Just prog <- optDiff opts ->
|
||||
do goldFile' <- canonicalizePath goldFile
|
||||
assertFailure (unwords [ prog, goldFile', "\\\n ", resultOut ])
|
||||
assertFailure $ unlines
|
||||
[ unwords [ prog, goldFile', "\\\n ", resultOut ]
|
||||
, makeGold resultOut goldFile
|
||||
]
|
||||
|
||||
| otherwise ->
|
||||
do goldFile' <- canonicalizePath goldFile
|
||||
(_,diffOut,_) <- readProcessWithExitCode "diff" [ goldFile', resultOut ] ""
|
||||
assertFailure diffOut
|
||||
assertFailure $ unlines [ diffOut, makeGold resultOut goldFile ]
|
||||
|
||||
Right fail_msg | optIgnoreExpected opts -> return ()
|
||||
| otherwise -> assertFailure fail_msg
|
||||
|
||||
makeGold out gold =
|
||||
unlines [ "# If output is OK:"
|
||||
, unwords [ "cp", out, "\\\n ", gold ]
|
||||
]
|
||||
|
||||
-- Test Discovery --------------------------------------------------------------
|
||||
|
||||
findTests :: [FilePath] -> IO TestFiles
|
||||
|
Loading…
Reference in New Issue
Block a user