我有一个脚本系统的make文件,有很多测试应该通过。每个测试都是对脚本应用程序的单独调用:
#----------------------------------------------------------------------------
# run test scripts in the module::test
#----------------------------------------------------------------------------
scripted_tests: bin/kin modules/test/actor_equality.kin modules/test/actor_fibre.kin ...
bin/kin modules/test/actor_equality.kin
bin/kin modules/test/actor_fibre.kin
...这很好。我也有一些类似的测试,应该会返回失败。我知道-会忽略返回状态,但必须有一些简单的方法来反转返回状态,这样我才能运行
#----------------------------------------------------------------------------
# run test scripts in the module::test::errors
#----------------------------------------------------------------------------
inverse_tests: bin/kin modules/test/error/bad_function.kin ...
not bin/kin modules/test/error/bad_function.kin
...发布于 2009-10-09 20:52:27
使用!命令。
echo This returns success
! echo This returns failure发布于 2010-11-10 08:55:41
假设您想确保"bin/kin test5.kin“的退出状态为5,则只需编写以下代码:
run-test5:
bin/kin test5.bin; test $$? = 5更详细的测试见“help test”和“man test”。
注意:我倾向于避免使用感叹号,因为通常不可能将它们复制/粘贴到交互式shell中(因为它会搜索历史记录)。
https://stackoverflow.com/questions/1545985
复制相似问题