Skip to content

Commit

Permalink
Add failing test case for cabal build --enable-build-info
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Apr 24, 2024
1 parent 3395fa1 commit 1ef3e38
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/Lib.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Lib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: WithProject
version: 0.1.0.0
build-type: Simple

common warnings
ghc-options: -Wall

library
import: warnings
exposed-modules: Lib
build-depends: base
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: ./

package WithProject
ghc-options: -haddock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# cabal build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- WithProject-0.1.0.0 (lib) (first run)
Configuring library for WithProject-0.1.0.0...
Preprocessing library for WithProject-0.1.0.0...
Building library for WithProject-0.1.0.0...
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}
import Test.Cabal.Prelude
import Test.Cabal.DecodeShowBuildInfo

main = cabalTest $ do
runShowBuildInfo ["lib:WithProject"]
withPlan $ do
recordBuildInfo "WithProject" mainLib
assertComponent "WithProject" mainLib defCompAssertion
{ compilerArgsPred = ("-Wall" `elem`) -- added by 'WithProject.cabal'
}

-- See #9927
fails $ assertComponent "WithProject" mainLib defCompAssertion
{ compilerArgsPred = ("-haddock" `elem`) -- added by 'cabal.project'
}

0 comments on commit 1ef3e38

Please sign in to comment.