Merge pull request #10493 from Sdywolf/doc-refine/repl
[cabal.git] / cabal-testsuite / PackageTests / HaddockKeepsTmps / cabal.test.hs
blob3a76caadf6cc4dde76f825a2f8473f401d367109
1 import Data.List (isPrefixOf, sort)
2 import Distribution.Simple.Glob
3 import Distribution.Simple.Glob.Internal
4 import Distribution.Simple.Utils
5 import Distribution.Verbosity
6 import System.Directory
7 import Test.Cabal.Prelude
9 -- Test that "cabal haddock" preserves temporary files
10 -- We use haddock-keep-temp-file: True in the cabal.project.
11 main =
12 cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do
13 cabal "haddock" []
15 -- From the docs for `System.IO.openTempFile`:
17 -- On Windows, the template prefix may be truncated to 3 chars, e.g.
18 -- "foobar.ext" will be "fooXXX.ext".
19 let glob =
20 if isWindows
21 then "had*.txt"
22 else "haddock-response*.txt"
24 -- Check that there is a response file.
25 responseFiles <- assertGlobMatchesTestDir testTmpDir glob
27 -- Check that the matched response file is not empty, and is indeed a Haddock
28 -- response file.
29 assertAnyFileContains responseFiles "--package-name"