I've a make file for a scripted system, with a lot of tests which should pass. Each test is a separate call to the scripting application:
#----------------------------------------------------------------------------
# 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
...
Which is fine. I also have some similar tests which should return failure. I know that -
will ignore the return status, but there must be something simple to invert the return status so I can run
#----------------------------------------------------------------------------
# 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
...
Use the !
command.
echo This returns success
! echo This returns failure
Suppose you want to make sure that the exit status of "bin/kin test5.kin" is 5. Then just write this:
run-test5:
bin/kin test5.bin; test $$? = 5
For more elaborated tests see 'help test' and 'man test'.
Note: I tend to avoid exclamation marks because it is typically impossible to copy/paste them into an interactive shell (since it searches the history).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With