简体   繁体   English

Haskell单元测试集成在Leksah中

[英]Haskell Unit Testing integrated in Leksah

I'm writing some Haskell code in the Leksah IDE. 我在Leksah IDE中编写了一些Haskell代码。 As I edit the code, Leksah does background compilation and runs unit tests after the background compilation completes. 当我编辑代码时,Leksah进行后台编译并在后台编译完成后运行单元测试。

I see in the "console" frame the following: 我在“控制台”框架中看到以下内容:

Building UNFI-EIC-0.0.1...
Preprocessing test suite 'test-UNFI-EIC' for UNFI-EIC-0.0.1...
Preprocessing executable 'UNFI-EIC' for UNFI-EIC-0.0.1...
-----------------------------------------
Running 1 test suites...
Test suite test-UNFI-EIC: RUNNING...
test-UNFI-EIC: Prelude.head: empty list
Test suite test-UNFI-EIC: FAIL
Test suite logged to: dist/test/UNFI-EIC-0.0.1-test-UNFI-EIC.log
0 of 1 test suites (0 of 1 test cases) passed.

Where are the default test cases that failed? 失败的默认测试用例在哪里? How do I add relevant unit tests to them? 如何向他们添加相关的单元测试? There is nothing obvious in the GUI menus... GUI菜单中没有任何明显的东西......

How can I edit the test suite for the package that is integrated in Leksah? 如何编辑Leksah中集成的软件包的测试套件?

You can edit the unit test suite by finding the test-suite reference in the .cabal file of the project. 您可以通过在项目的.cabal文件中查找测试套件参考来编辑单元测试套件。

To do this, go to your project directory and open *.cabal in a text editor and search for the line containing test-suite: . 为此,请转到项目目录并在文本编辑器中打开*.cabal并搜索包含test-suite:的行test-suite: This line will be of the form test-suite: ExampleTests , where ExampleTests is the main file of the test suite for the project. 此行将采用test-suite: ExampleTests的形式test-suite: ExampleTests ,其中ExampleTests是项目测试套件的main文件。

Simply add tests to this file using the testing framework of your choice. 只需使用您选择的测试框架将测试添加到此文件中。 Leksah will run these tests automatically through the IDE GUI. Leksah将通过IDE GUI自动运行这些测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM