testing - Cabal 输出被重定向但未生成

我有一个相当简单的 haskell 项目设置,我只想让框架在我真正开始编码之前进行测试等工作。我在 /src 目录(其中 / 是项目的根目录)中有可执行文件的源文件,在 /testsuite 目录中有我的测试. /testsuite 包含一个名为 TestSuite.hs 的简单测试文件,其中 main = Test.Framework.defautMain tests 作为 main 的实现。问题是,当我运行时

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 时,构建工作正常。我的阴谋文件是:

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,因为我目前没有使用 (==>),这是我目前需要的唯一功能。其余的应该是直截了当的。任何帮助将不胜感激。

最佳答案

您应该在 TestSuite.hs 文件中将模块名称定义为 Main,例如 there例如。

引自 The Haskell 98 Report :

A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main.

https://stackoverflow.com/questions/12133320/

相关文章:

maven-2 - 在 Maven 中覆盖 'clean' 生命周期

xcode - 如何在 Xcode 项目包中排除图像文件,有条件地用于发布版本?

c# - "Build"构建我的项目,"Build Solution"没有

visual-studio - 成功构建完成后如何获得通知?

build - 如何重建已下载的已编辑 perl6 模块?

qt - 在 Ubuntu Linux 上构建 QT 库

android - 错误 JSON.simple : java. util.zip.ZipExcep

visual-studio - 使用 cmake 和命令行构建 MSVC 项目

build - cmake 创建一个共享对象

build - bmake的优点