如何运行用 Guile 编写的 TAP::Harness 测试?

发布于 2024-07-04 16:26:26 字数 180 浏览 5 评论 0原文

通常的方法

test:
    $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INCDIRS)')" $(TEST_FILES)

无法运行 Guile 脚本,因为它向 Guile 传递了额外的参数“-w”。

The usual approach of

test:
    $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INCDIRS)')" $(TEST_FILES)

fails to run Guile scripts, because it passes to Guile the extra parameter "-w".

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

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

发布评论

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

评论(1

那请放手 2024-07-11 16:26:26

一种可能的方法是按如下方式设置您的项目。

您的目录结构如下:

./project              Your project files
./project/t/*.t        Your unit test scripts
./project/t/scripts/*  Auxiliary scripts used by your unit tests

您的./project/Makefile包含以下内容:

PERL = /usr/bin/perl
TEST_LIBDIRS = ./lib
RUN_GUILE_TESTS = ./t/scripts/RunGuileTests.pl
TEST_FILES = ./t/*.t

test:
    $(PERL) -I$(TEST_LIBDIRS) $(RUN_GUILE_TESTS) $(TEST_FILES)

您的./project/t/scripts/RunGuileTests.pl内容是:

#!/usr/bin/perl -w
# Run Guile tests - filenames are given as arguments to the script.

use TAP::Harness;
my @tests = @ARGV;
my %args = (
    verbosity => 0,
    timer => 1,
    show_count => 1,
    exec => ['/usr/bin/guile', '-s'],
    );
my $harness = TAP::Harness->new( \%args );
        $harness->runtests(@tests);

# End of RunGuileTests.pl

您的Guile测试脚本应该从以下内容开始:

#!/usr/bin/guile -s
!#
; Description of your tests

One possible approach is to set up your project as follows.

Your directory structure is as follows:

./project              Your project files
./project/t/*.t        Your unit test scripts
./project/t/scripts/*  Auxiliary scripts used by your unit tests

Your ./project/Makefile contains the following:

PERL = /usr/bin/perl
TEST_LIBDIRS = ./lib
RUN_GUILE_TESTS = ./t/scripts/RunGuileTests.pl
TEST_FILES = ./t/*.t

test:
    $(PERL) -I$(TEST_LIBDIRS) $(RUN_GUILE_TESTS) $(TEST_FILES)

Your ./project/t/scripts/RunGuileTests.pl contents are:

#!/usr/bin/perl -w
# Run Guile tests - filenames are given as arguments to the script.

use TAP::Harness;
my @tests = @ARGV;
my %args = (
    verbosity => 0,
    timer => 1,
    show_count => 1,
    exec => ['/usr/bin/guile', '-s'],
    );
my $harness = TAP::Harness->new( \%args );
        $harness->runtests(@tests);

# End of RunGuileTests.pl

Your Guile test scripts should start with:

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