Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do doctests test suites always need to depend on the library? #19

@RyanGlScott

Description

@RyanGlScott

It seems that doctests test suites might always have an implicit dependency on the library being tested. I noticed this when doing the following:

$ cabal get parsers-0.12.5
Unpacking to parsers-0.12.5/
$ cd parsers-0.12.5/
$ cabal configure --enable-tests
Resolving dependencies...
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring parsers-0.12.5...
$ cabal test doctests
Preprocessing test suite 'doctests' for parsers-0.12.5..
Building test suite 'doctests' for parsers-0.12.5..

<no location info>: warning: [-Wmissing-home-modules]
    These modules are needed for compilation but not listed in your .cabal file's other-modules: Build_doctests
[1 of 2] Compiling Build_doctests   ( dist/build/doctests/autogen/Build_doctests.hs, dist/build/doctests/doctests-tmp/Build_doctests.o )
[2 of 2] Compiling Main             ( tests/doctests.hs, dist/build/doctests/doctests-tmp/Main.o )

<no location info>: warning: [-Wmissing-home-modules]
    These modules are needed for compilation but not listed in your .cabal file's other-modules: Build_doctests
Linking dist/build/doctests/doctests ...
Running 1 test suites...
Test suite doctests: RUNNING...

<command-line>:7:0: error:
     fatal error: dist/build/autogen/cabal_macros.h: No such file or directory
compilation terminated.
-i
-i/home/rgscott/Documents/Hacking/Haskell/parsers-0.12.5/dist/build/autogen
-i/home/rgscott/Documents/Hacking/Haskell/parsers-0.12.5/dist/build
-i/home/rgscott/Documents/Hacking/Haskell/parsers-0.12.5/src
-hide-all-packages
-package-db=dist/package.conf.inplace
-optP-include
-optPdist/build/autogen/cabal_macros.h
-package-id=base-4.10.0.0
-package-id=base-orphans-0.6-9iPDLrUqQ5yHb9fb9OUZ9L
-package-id=charset-0.3.7.1-GkbAILH2Vj9HXMMGXPSeNg
-package-id=containers-0.5.10.2
-package-id=parsec-3.1.11-DPgnR92AWEaFOaixmwipet
-package-id=attoparsec-0.13.1.0-2xtipSJ3oFDBfLwedqccX
-package-id=text-1.2.2.2-EGUst8sqNAZCw1xLPcmcMH
-package-id=transformers-0.5.2.0
-package-id=mtl-2.2.1-19EL8AGBsN3DnnOhrC9xY3
-package-id=scientific-0.3.5.1-L0qYzdp0wpz8rO8gircNSR
-package-id=unordered-containers-0.2.8.0-HVcKYx0GQoVIIbKuoCcJbx
-package-id=bytestring-0.10.8.2
-package-id=directory-1.3.0.2
-package-id=doctest-0.12.0-JcuLvnckae744xvqjXdMWF
-package-id=filepath-1.4.1.2
-package-id=QuickCheck-2.10.0.1-DTIBC3CyU6p3h4xSnOjkg1
-package-id=quickcheck-instances-0.3.16-A15GUudjPiB6fV2AyfxwM5
Text.Parser.Char
Text.Parser.Combinators
Text.Parser.LookAhead
Text.Parser.Permutation
Text.Parser.Expression
Text.Parser.Token
Text.Parser.Token.Style
Text.Parser.Token.Highlight
doctests: `gcc' failed in phase `C pre-processor'. (Exit code: 1)
Test suite doctests: FAIL
Test suite logged to: dist/test/parsers-0.12.5-doctests.log
0 of 1 test suites (0 of 1 test cases) passed.

The culprit appears to be that the doctests test suite in parsers lacks an explicit dependency on the parsers library. If I add that, then cabal test doctests works as expected.

Currently, we advise users in the documentation to depend on the library in a doctests test suite only in the event that one uses cbits, but perhaps we should always be advising this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions