From e21acd43bd6095dea691861055b5e162e9bab069 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Wed, 25 Sep 2024 10:16:26 -0700 Subject: [PATCH] Fix `--accept` flag in `cabal-testsuite` This was broken in #10225 --- cabal-testsuite/src/Test/Cabal/Monad.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index 38534402d26..17471c3bd47 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -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) @@ -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