如何使用 DSSS 和 GDC 运行单元测试?

发布于 2024-08-24 01:18:53 字数 565 浏览 4 评论 0原文

我对 D 非常陌生,仍在努力配置我的工具链。

我正在运行 Ubuntu Karmic,并且希望将 DSSS 与 GDC 和 Tango 或 TangoBos 一起使用。

到目前为止,我从 Ubuntu 存储库、DSSS、Tango 和 TangoBos 安装了 这些存储库,我可以使用 dsss + gdc + tangobos 进行编译。

根据 DSSS 文档,应该可以使用运行单元测试,

$ dsss build --test

但在我的系统上, --test 参数被忽略。我有 dsss 最新版本(0.78),它的内联帮助不包含任何有关单元测试的内容。

运行 ldc --unittest 工作正常(尽管我不知道它到底选择哪个库)。

有没有办法使用相同的编译器和运行我的单元测试?库而不是编译?

如果是这样,有没有办法自动化测试,或者我必须每个模块运行它?

I am very new to D and still battling trying to configure my toolchain.

I am running Ubuntu Karmic and would like to use DSSS with GDC and Tango or TangoBos.

Till now, I installed GDC from Ubuntu repositories, DSSS, Tango and TangoBos from these repositories and I can compile using dsss + gdc + tangobos.

According to DSSS documentation, it should be possible to run the unit tests using

$ dsss build --test

but on my system, the --test argument is ignored. I have dsss last version (0.78) and its inline help does not include anything about unit tests.

Running ldc --unittest works fine (though I do not know exactly which libray it picks up).

Is there a way to run my unit tests using the same compiler & library than for compilation?

If so, is there a way to automate the testing or will I have to run it module per module?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡淡の花香 2024-08-31 01:18:53

据我所知,在 Karmic 前后,Ubuntu 的 gdc 安装开始忽略诸如“--foo”之类的参数。

观察:

$ gdc --not-a-real-option
gdc: no input files

比较

$ gdc -not-a-real-option
gdc: unrecognized option '-not-a-real-option'
gdc: no input files

与 Lucid dsss 版本 0.76、gdc (Ubuntu 1:1.046-4.3.4-3ubuntu1) 4.3.4 上的 So

dsss build -test 

,或者

dsss build -unittest

应该使用单元测试进行编译

As best I can tell, sometime around Karmic, Ubuntu's install of gdc started ignoring arguments such as "--foo".

Observe:

$ gdc --not-a-real-option
gdc: no input files

vs.

$ gdc -not-a-real-option
gdc: unrecognized option '-not-a-real-option'
gdc: no input files

So on Lucid dsss version 0.76, gdc (Ubuntu 1:1.046-4.3.4-3ubuntu1) 4.3.4,

dsss build -test 

or

dsss build -unittest

should compile with unit tests

你没皮卡萌 2024-08-31 01:18:53

我会使用“dsss build -unittest”。我还没有尝试过,但我通过谷歌搜索发现它被使用了。

I would use "dsss build -unittest". I haven't tried it, but I see it being used with a little googling.

终难遇 2024-08-31 01:18:53

我知道这个问题很古老,但在搜索这个问题时它会突出出现。

我发现 gdc 使用 -funittest 选项,如下所示:

gdc -funittest -g -o unittest File1.d
./unittest

这会将单个 dlang 文件编译为名为unittest的可执行文件,然后运行该可执行文件,该可执行文件将执行代码中的unittest部分并显示任何失败的断言。

I know this question is ancient, but it comes up prominently when searching on this issue.

I found that gdc works with the -funittest option, like this:

gdc -funittest -g -o unittest File1.d
./unittest

This will compile a single dlang file into an executable called unittest and then run the executable which will execute the unittest sections in the code and display any failed assertions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文