Skip to content

Commit

Permalink
Fix --accept flag in cabal-testsuite
Browse files Browse the repository at this point in the history
This was broken in haskell#10225
  • Loading branch information
9999years authored and erikd committed Oct 24, 2024
1 parent e26e23e commit e21acd4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cabal-testsuite/src/Test/Cabal/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ runTestM mode m =
b <- diff ["-uw"] expect_fp actual_fp
unless b . void $ diff ["-u"] expect_fp actual_fp
if accept
then do liftIO $ putStrLn "Accepting new output."
then do liftIO $ putStrLn $ "Writing actual test output to " <> testExpectFile env
liftIO $ writeFileNoCR (testExpectFile env) actual
pure (pure ())
else pure (E.throwIO TestCodeFail)
Expand Down Expand Up @@ -880,10 +880,10 @@ testUserCabalConfigFile env = testCabalDir env </> "config"

-- | The file where the expected output of the test lives
--
-- Pointing to the @testTmpDir@ allows us to modify the expected output if
-- needed, to adapt it to outcomes of previous steps in the test.
-- Note: This needs to point to `testSourceDir` so we write @--accept@ output
-- in the correct place.
testExpectFile :: TestEnv -> FilePath
testExpectFile env = testTmpDir env </> testName env <.> "out"
testExpectFile env = testSourceDir env </> testName env <.> "out"

-- | Where we store the actual output
testActualFile :: TestEnv -> FilePath
Expand Down

0 comments on commit e21acd4

Please sign in to comment.