2

"data-binary-ieee754" を使用するプロジェクトを doctests でテストしようとしています。

パッケージの依存関係を管理するために、cabal の代わりに cabal-dev を使用しています。プロジェクトをビルドできますが、doctest はそのパッケージを認識しないようです。

.cabal の doctests 定義:

test-suite doctests
  type:            exitcode-stdio-1.0
  hs-source-dirs:  test
  main-is:         doctests.hs
  ghc-options:     -Wall -threaded
  build-depends:   base,
                   doctest >= 0.7,
                   data-binary-ieee754

テスト/doctests.hs:

module Main where

import Test.DocTest

main :: IO ()
main = doctest ["src/Pattern.hs"]

のエラー メッセージcabal-dev test doctestsは次のとおりです。

Running 1 test suites...
Test suite doctests: RUNNING...

src/Pattern.hs:13:8:
    Could not find module `Data.Binary.IEEE754'
    Use -v to see a list of the files searched for.
Test suite doctests: FAIL
Test suite logged to: dist/test/othello-0.1.0-doctests.log
0 of 1 test suites (0 of 1 test cases) passed.

次のように、doctests.hsにいくつかのオプションを追加しようとしました

main = doctest ["--optghc=-Lcabal-dev/lib",
                "--optghc=-packagedata-binary-ieee754",
                "src/Pattern.hs"]

しかし、結果は

Running 1 test suites...
Test suite doctests: RUNNING...
doctests: <command line>: cannot satisfy -package data-binary-ieee754
    (use -v for more information)
Test suite doctests: FAIL
Test suite logged to: dist/test/othello-0.1.0-doctests.log
0 of 1 test suites (0 of 1 test cases) passed.

これを正しく行う方法を教えてください。ありがとう。

4

2 に答える 2

3

私は自分で答えを見つけました。

http://hackage.haskell.org/trac/ghc/ticket/6133は役に立ちました。

main :: IO ()
main = doctest ["--optghc=-Lcabal-dev/lib",
                "--optghc=-packagedata-binary-ieee754",
                "--optghc=-package-conf=cabal-dev/packages-7.4.1.conf",
                "src/Pattern.hs"]
于 2012-08-10T02:07:58.020 に答える