Skip to content

Commit

Permalink
Add haddock --keep-temp-files test
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Sep 30, 2024
1 parent 9aefa85 commit 833cc2c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Distribution.Simple

main = defaultMain
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Simple.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Simple where

-- | For hiding needles.
data Haystack = Haystack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: .

haddock-keep-temp-files: true
15 changes: 15 additions & 0 deletions cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{-# LANGUAGE LambdaCase #-}

import Test.Cabal.Prelude

-- Test that "cabal haddock" preserves temporary files
-- We use haddock-keep-temp-file: True in the cabal.project.
main = cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do
cabal "haddock" []

-- Check that there is a response file.
responseFiles <- assertGlobMatchesTestDir testDistDir "**/haddock-response*.txt"

-- Check that the matched response file is not empty, and is indeed a Haddock
-- response file.
assertAnyFileDoesContain responseFiles "--package-name"
16 changes: 16 additions & 0 deletions cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/my.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cabal-version: 3.0
name: HaddockKeepsTmpsCustom
version: 0.1
license: BSD-3-Clause
author: Rodrigo Mesquita
stability: stable
category: PackageTests
build-type: Custom

custom-setup
setup-depends: Cabal, base

library
default-language: Haskell2010
exposed-modules: Simple
build-depends: base

0 comments on commit 833cc2c

Please sign in to comment.