如何运行以Guile编写的TAP :: Harness测试?
时间:2020-03-05 18:55:51 来源:igfitidea点击:
通常的做法
test: $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INCDIRS)')" $(TEST_FILES)
无法运行Guile脚本,因为它将额外的参数" -w"传递给了Guile。
解决方案
回答
一种可能的方法是按照以下步骤设置项目。
目录结构如下:
./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