Skip to content

Commit

Permalink
Add test for default-package-bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Dec 27, 2023
1 parent 9c113a0 commit e5946a9
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int
md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion
md5CheckGenericPackageDescription proxy = md5Check proxy
#if MIN_VERSION_base(4,19,0)
0xc638caeb7531f107f64d12773f9430d0
0xae37c23fa8d463c4db8948c9971690ef
#else
0x7a231bff7bb37049ec7f2ebfd98d3243
0x21f4a39a92b847b6632462c8a60539f6
#endif

md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion
md5CheckLocalBuildInfo proxy = md5Check proxy
#if MIN_VERSION_base(4,19,0)
0x023b3cd1665b2acdedf72d231c96336b
0x3e26b843d4bcc009bbc0a0ce3e3a3637
#else
0xc6c0cc122cc60ce7943764cbaaacdc2d
0x8f30685ed435311bb5bd30b921356280
#endif
31 changes: 31 additions & 0 deletions cabal-testsuite/PackageTests/DefaultPackageBounds/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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: time (dependency of foo)
[__2] rejecting: time-<VERSION>/installed-<HASH> (conflict: foo *test => time<0)
[__2] fail (backjumping, conflict set: foo, time, 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), time (2)
# cabal check
These warnings will likely cause trouble when distributing the package:
Warning: No 'category' field.
Warning: No 'maintainer' field.
These warnings may cause trouble when distributing the package:
Warning: library does not expose any modules
Warning: On package-constraints, these packages miss upper bounds:
- process
Please add them. There is more information at https://pvp.haskell.org/
The following errors will cause portability problems on other environments:
Error: No 'synopsis' or 'description' field.
Error: The 'license' field is missing or is NONE.
Error: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

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

default-package-bounds:
-- time bound should not apply on lib, there is a specific bound defined,
-- however it should prevent the @tests@ from building
, time <0
-- deepseq bound should never apply, we don't depend on it
, deepseq <0
-- check will report this missing upper bound
, process

library
build-depends:
time >1
default-language: Haskell2010

test-suite tests
build-depends: time
default-language: Haskell2010
main-is: Main.hs

0 comments on commit e5946a9

Please sign in to comment.