问题描述
我试图在我的.cabal配置中为我的项目创建一个测试套件 HaskSplit
:
- 由cabal init生成的初始HaskSplit.cabal。更多
- 文档,请参阅http://haskell.org/cabal/users-guide/
名称:HaskSplit
版本:0.1.0.0
简介:Haskell实施Shamir秘密共享计划
- 描述:
许可证:MIT
许可证文件:许可
作者:
维护者:
- 版权:
类别:安全性
构建类型:简单
- 额外源文件:
cabal-version:> = 1.10
可执行文件HaskSplit
main-is:Main.hs
default-language:Haskell2010
- other-modules:
other-extensions:TemplateHaskell,NoImplicitPrelude,RankNTypes,OverloadedStrings
build-depends:base> = 4.6&& < 4.7,
resourcet> = 1.1&& < 1.2,
字节串> = 0.10&& < 0.11,
conduit-extra> = 1.1&& < 1.2,
vector> = 0.10&& < 0.11,
conduit> = 1.1&& < 1.2,
管道组合器> = 0.2&& < 0.3,
单程可行> = 0.5&& < 0.6,
safe> = 0.3&& < 0.4,
变压器> = 0.3&& < 0.4,
filepath> = 1.3,
目录> = 1.2,
Glob> = 0.7.4,
错误> = 1.4,
optparse-applicative> = 0.8
hs-source-dirs:src
default-language:Haskell2010
ghc-options:-Wall -fno-warn-orphans
测试套件测试
类型:exitcode-stdio-1.0
default-language:Haskell2010
hs-source-dirs:测试
main-is:Test.hs
ghc-options:-Wall -fno-warn-orphans
build-depends:base == 4. *,
QuickCheck> = 2.6&& < 2.7,
test-framework-quickcheck2> = 0.3.0.3,
HaskSplit
查看示例测试套件设置,我注意到它们是指定他们自己的包作为构建依赖模块之一。因此,我也做了同样的事情,以便我的测试套件的 build-depends
列表保持简短。
然而,当我在命令行中尝试 cabal repl test:tests
时,我收到以下错误:
<$ p $ <命令行> ;:无法满足-package-id HaskSplit-0.1.0.0 -inplace
我不太确定我在这里错过了什么,任何人都可以帮助我?它在这里发生循环依赖吗?或者是否需要为build-depends创建我的包的库实例?
谢谢!
exposed-modules
部分应列出您的测试(或库的任何其他用户)可能需要引用的所有模块。 作为创建库的替代方案,您可以简单地将需要的模块添加到测试套件部分的其他模块部分。如果你想包含很多模块,我认为库方法更好。
I'm attempting to create a test suite for my project, HaskSplit
in my .cabal configuration:
-- Initial HaskSplit.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: HaskSplit
version: 0.1.0.0
synopsis: Haskell Implementation of Shamir's Secret Sharing Scheme
-- description:
license: MIT
license-file: LICENSE
author:
maintainer:
-- copyright:
category: Security
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
executable HaskSplit
main-is: Main.hs
default-language: Haskell2010
-- other-modules:
other-extensions: TemplateHaskell, NoImplicitPrelude, RankNTypes, OverloadedStrings
build-depends: base >=4.6 && <4.7,
resourcet >=1.1 && <1.2,
bytestring >=0.10 && <0.11,
conduit-extra >=1.1 && <1.2,
vector >=0.10 && <0.11,
conduit >=1.1 && <1.2,
conduit-combinators >=0.2 && <0.3,
mono-traversable >=0.5 && <0.6,
safe >=0.3 && <0.4,
transformers >=0.3 && <0.4,
filepath >= 1.3,
directory >=1.2,
Glob >= 0.7.4,
errors >= 1.4,
optparse-applicative >= 0.8
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -fno-warn-orphans
test-suite tests
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: tests
main-is: Test.hs
ghc-options: -Wall -fno-warn-orphans
build-depends: base == 4.*,
QuickCheck >=2.6 && <2.7,
test-framework-quickcheck2 >= 0.3.0.3,
HaskSplit
Looking at an example test-suite setup here, I noticed that they're specifying their own package as one of the build-depends module. Therefore I did the same, so that I can keep my build-depends
list for my test-suite short.
However when I try cabal repl test:tests
in commandline, I'm getting the following error:
<command line>: cannot satisfy -package-id HaskSplit-0.1.0.0-inplace
I'm not too sure what I'm missing here, can anyone help me out? Is it cyclic dependencies happening around here? Or do I need to create a library instance of my package for the build-depends to work?
Thanks!
The build-depends
section can only contain libraries, not modules. I suggest you add a library to your cabal file. The exposed-modules
section of the library should list all of the modules that your test (or any other user of the library) might need to reference.
As an alternative to creating a library, you could simply add the modules you need to the other-modules part of the test-suite section. If you want to include a lot of modules, though, I think the library approach is nicer.
这篇关于创建测试套件时出错:“无法满足-package-id”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!