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 e442174
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ tests = testGroup "Distribution.Utils.Structured"
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
, testCase "GenericPackageDescription" $
md5Check (Proxy :: Proxy GenericPackageDescription) 0xb287a6f04e34ef990cdd15bc6cb01c76
md5Check (Proxy :: Proxy GenericPackageDescription) 938eba2cc4fe10bb1f954d05c253d575
, testCase "LocalBuildInfo" $
md5Check (Proxy :: Proxy LocalBuildInfo) 0x26e91a71ebd19d4d6ce37f798ede249a
md5Check (Proxy :: Proxy LocalBuildInfo) 0x4adc7abeee033098c254f167d4521d64
#endif
]

Expand Down
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 e442174

Please sign in to comment.