使用cabal从测试包中导入测试工具模块

时间:2020-07-25 15:38:05

标签: unit-testing haskell testing hspec

我具有以下项目结构:

project
+ src
|___ Func.hs
+ test
|___ ASpec.hs
|___ BSpec.hs
|___ Spec.hs
|___ Utils.hs

我想从UtilsASpec导入BSpec模块,可惜默认情况下似乎无法实现。 我也尝试在我的阴谋文件中创建第二个library节,但是我不能依靠它。 我该如何在集团档案中表达这一点?

name:                project
version:             0.1.0.0
synopsis:            something
-- description:
homepage:            https://github.com/xx/project#readme
license:             BSD2
license-file:        LICENSE
author:              me
maintainer:          me@domail.tld
copyright:           2020 Me
category:            Text
build-type:          Simple
extra-source-files:  README.md
cabal-version:       >=1.10

library
  hs-source-dirs:      src
  ghc-options:         -Werror -fwarn-missing-methods
  exposed-modules:     Func
  build-depends:       base >= 4.12 && < 5
  default-language:    Haskell2010

test-suite project-test
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  other-modules:       ASpec
                     , BSpec
  main-is:             Spec.hs
  build-depends:       base
                     , project
                     , hspec
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  default-language:    Haskell2010

source-repository head
  type:     git
  location: https://github.com/xx/project

0 个答案:

没有答案