`cabal test` fails to include dependency from library in test suite
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
```
name: byteunits
version: 0.1.0.0
description: Human friendly workings with byte units
license: BSD3
license-file: LICENSE
author: CabalSaneDefault
maintainer: nobody
-- copyright:
-- category:
build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
library
exposed-modules: ByteUnits
build-depends: base >=4.9 && <4.10
, safe
default-language: Haskell2010
Test-Suite testing-example
Type: exitcode-stdio-1.0
Main-is: Tests.hs
build-depends: base
, Cabal
, QuickCheck
, byteunits
```
cabal --version
cabal-install version 1.22.8.0
using version 1.22.7.0 of the Cabal library
`cabel test`:
```
/byteunits.cabal has been changed. Re-configuring with most recently used
options. If this fails, please run configure manually.
Warning: The package list for 'hackage.haskell.org' is 22.0 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring byteunits-0.1.0.0...
Warning: Packages using 'cabal-version: >= 1.10' must specify the
'default-language' field for each component (e.g. Haskell98 or Haskell2010).
If a component uses different languages in different modules then list the
other ones in the 'other-languages' field.
Preprocessing library byteunits-0.1.0.0...
on the commandline: warning:
-this-package-key is deprecated: Use -this-unit-id instead
on the commandline: warning:
-this-package-key is deprecated: Use -this-unit-id instead
In-place registering byteunits-0.1.0.0...
cabal: '/usr/bin/ghc-pkg' exited with an error:
byteunits-0.1.0.0: Warning: haddock-interfaces:
/home/chris/Projects/Haskell/byteunits/dist/doc/html/byteunits/byteunits.haddock
doesn't exist or isn't a file
byteunits-0.1.0.0: Warning: haddock-html:
/home/chris/Projects/Haskell/byteunits/dist/doc/html/byteunits doesn't exist
or isn't a directory
byteunits-0.1.0.0: installed package info from too old version of Cabal (key
field does not match id field)
```
`stack test`:
```
byteunits-0.1.0.0: configure (lib + test)
Configuring byteunits-0.1.0.0...
Warning: Packages using 'cabal-version: >= 1.10' must specify the
'default-language' field for each component (e.g. Haskell98 or Haskell2010).
If a component uses different languages in different modules then list the
other ones in the 'other-languages' field.
byteunits-0.1.0.0: build (lib + test)
Preprocessing library byteunits-0.1.0.0...
Preprocessing test suite 'testing-example' for byteunits-0.1.0.0...
[1 of 2] Compiling ByteUnits ( ByteUnits.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/testing-example/testing-example-tmp/ByteUnits.o )
/home/chris/Projects/Haskell/byteunits/ByteUnits.hs:3:1: error:
Failed to load interface for ‘Safe’
It is a member of the hidden package ‘safe-0.3.15’.
Perhaps you need to add ‘safe’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Progress: 1/2
-- While building package byteunits-0.1.0.0 using:
/home/chris/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0 build lib:byteunits test:testing-example --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
```
**Test.hs**
```
module Main where
import Test.QuickCheck (quickCheck)
import ByteUnits
main = do
quickCheck ("" == "")
```
This works correctly if I remove `import ByteUnits` from **Test.hs**.
Project available here: https://github.com/chrissound/byteunits
Contributor guide
Assessment
This issue has not been assessed yet.