Skip to content

Commit

Permalink
Add a regression test for issue #4288.
Browse files Browse the repository at this point in the history
  • Loading branch information
grayjay committed Feb 26, 2018
1 parent ea01b9d commit f4f382a
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cabal-testsuite/PackageTests/NewBuild/T4288/CustomIssue.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module CustomIssue where

f x = x + 1
3 changes: 3 additions & 0 deletions cabal-testsuite/PackageTests/NewBuild/T4288/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import SetupHelper (setupHelperDefaultMain)

main = setupHelperDefaultMain
16 changes: 16 additions & 0 deletions cabal-testsuite/PackageTests/NewBuild/T4288/T4288.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: T4288
version: 1.0
build-type: Custom

-- cabal-version is lower than the version of Cabal that will be chosen for the
-- setup script.
cabal-version: >=1.10

-- Setup script only has a transitive dependency on Cabal.
custom-setup
setup-depends: base, setup-helper

library
exposed-modules: CustomIssue
build-depends: base
default-language: Haskell2010
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/NewBuild/T4288/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: . setup-helper/
17 changes: 17 additions & 0 deletions cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Test.Cabal.Prelude

-- This test is similar to the simplified example in issue #4288. The package's
-- setup script only depends on base and setup-helper. setup-helper exposes a
-- function that is a wrapper for Cabal's defaultMain (similar to
-- cabal-doctest). This test builds the package to check that the flags passed
-- to the setup script are compatible with the version of Cabal that it depends
-- on, even though Cabal is only a transitive dependency.
main = cabalTest $ do
skipUnless =<< hasNewBuildCompatBootCabal
r <- recordMode DoNotRecord $ cabal' "new-build" ["T4288"]
assertOutputContains "This is setup-helper-1.0." r
assertOutputContains
("In order, the following will be built: "
++ " - setup-helper-1.0 (lib:setup-helper) (first run) "
++ " - T4288-1.0 (lib:T4288) (first run)")
r
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module SetupHelper (setupHelperDefaultMain) where

import Distribution.Simple

setupHelperDefaultMain = putStrLn "This is setup-helper-1.0." >> defaultMain
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: setup-helper
version: 1.0
build-type: Simple
cabal-version: >= 1.2

library
exposed-modules: SetupHelper
build-depends: base, Cabal
default-language: Haskell2010

0 comments on commit f4f382a

Please sign in to comment.