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

时间:2008-09-16 13:06:46

标签: unit-testing guile

通常的方法

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

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

1 个答案:

答案 0 :(得分:1)

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

您的目录结构如下:

./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