Skip to content

Commit

Permalink
Add test for default-constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Nov 21, 2023
1 parent 74b621e commit 65b6fae
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/DefaultConstraints/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = pure ()
18 changes: 18 additions & 0 deletions cabal-testsuite/PackageTests/DefaultConstraints/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# cabal build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- foo-0.1.0.0 (lib) (first run)
Configuring library for foo-0.1.0.0...
Preprocessing library for foo-0.1.0.0...
Building library for foo-0.1.0.0...
# cabal build
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: foo-0.1.0.0 (user goal)
[__1] trying: foo:*test
[__2] next goal: base (dependency of foo)
[__2] rejecting: base-<VERSION>/installed-<HASH> (conflict: foo *test => base<0)
[__2] fail (backjumping, conflict set: base, foo, foo:test)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: foo (4), foo:test (3), base (2)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: foo
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/DefaultConstraints/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest $ withProjectFile "cabal.project" $ do
cabal "build" ["foo"]
fails $ cabal "build" ["foo", "--enable-tests"]
18 changes: 18 additions & 0 deletions cabal-testsuite/PackageTests/DefaultConstraints/foo/foo.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cabal-version: 3.11
name: foo
version: 0.1.0.0

default-constraints:
, base ^>=4.18.1.0

library
build-depends: base
default-language: Haskell2010

test-suite foo-test
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Main.hs
build-depends:
base <0,
blah

0 comments on commit 65b6fae

Please sign in to comment.