惊天动地输出重定向,但不会产生 [英] Cabal output is redirected but not generated

查看:135
本文介绍了惊天动地输出重定向,但不会产生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的Haskell项目设置,在这里我只是想有框架下与测试工作等之前,我确实开始编码。我有我的源文件在 / src目录目录中的可执行文件(其中 / 是项目的根)和我的测试在 /测试套件目录。 /测试套件包含一个名为 TestSuite.hs 一个简单的测试文件主要= Test.Framework。 defautMain测试作为主要的执行。问题是,当我运行

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.

构建工作正常,当我没有指定 - 使检验。我的小集团文件是:

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

我有禁用快速检查,因为我没有使用(==>)的那一刻,这是我目前从它唯一需要的功能。其余的应该是直线前进。任何帮助将大大AP preciated。

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 文件作为主<定义模块名称/ code>,如 的存在,例如

You should define module name in your TestSuite.hs file as Main, like there for example.

Haskell的98报告:

一个Haskell的程序模块,其中,按照惯例之一,必须调用主,必须导出值为主。集合

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

这篇关于惊天动地输出重定向,但不会产生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆