Cabal 输出被重定向但未生成 [英] Cabal output is redirected but not generated
问题描述
我设置了一个相当简单的 haskell 项目,我只想在实际开始编码之前让框架进行测试等工作.我在 /src
目录(其中 /
是项目的根目录)中有可执行文件的源文件,在 /testsuite
目录中有我的测试./testsuite
包含一个名为 TestSuite.hs
的简单测试文件,其中 main = Test.Framework.defautMain 测试
作为 main 的实现.问题是,当我运行
I have a fairly simple haskell project set up, where I just want to have the framework working with testing and so on before I actually start coding. I have my source files for an executable in a /src
directory (where /
is the project's root) and my tests in a /testsuite
directory. /testsuite
contains a simple test file called TestSuite.hs
with main = Test.Framework.defautMain tests
as the implementation of main. The problem is, when I run
cabal clean && cabal configure --enable-tests && cabal build
我收到警告
output was redirected with -o, but no output will be generated because there is no main module.
当我没有指定 --enable-tests
时,构建工作正常.我的阴谋文件是:
The build works fine when I don't specify --enable-tests
. My cabal file is:
Name: Example
Version: 0.1
Synopsis: Synopsis
Description:
Long description.
License: GPL
License-File: LICENSE
Author: SeanK
Maintainer: email@example.com
Category: Development
Build-Type: Simple
Cabal-Version: >= 1.8
Test-Suite test
Type: exitcode-stdio-1.0
Main-Is: TestSuite.hs
Build-Depends: base >= 3 && < 5,
test-framework,
test-framework-quickcheck
-- QuickCheck
Hs-Source-Dirs: src,
testsuite
Executable example
Main-Is: Main.hs
-- Other-Modules:
Build-Depends: base >= 3 && < 5,
haskell98
Hs-Source-Dirs: src
Ghc-Options: -Wall
我禁用了 QuickCheck,因为我目前没有使用 (==>),这是我目前需要的唯一功能.其余的应该是直截了当的.任何帮助将不胜感激.
I have QuickCheck disabled because I'm not using (==>) at the moment, which is the only function I currently need from it. The rest should be straight-forward. Any help would be greatly appreciated.
推荐答案
您应该在 TestSuite.hs
文件中将模块名称定义为 Main
,例如 那里.
You should define module name in your TestSuite.hs
file as Main
, like there for example.
引自 Haskell 98 报告:
Haskell 程序是一组模块,按照惯例,其中一个模块必须称为 Main,并且必须导出值 main.
A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main.
这篇关于Cabal 输出被重定向但未生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!