Commit 488e2c9e authored by Mathieu Giraud's avatar Mathieu Giraud

demo/: new examples

parent 2c62e8cd
# Several commands can be tested at once.
echo "I have a message for you"
echo -n "hello,"
$ The three commands ran successfully
: message
: hello
: world
# Note that all commands are actually run before the tests
# are checked on the joined output.
echo "world"
# 'should.py' usually checks that the command exits with 0.
# Other exit codes can be given
diff demo/hello.should demo/cal.should
$ 'world' is in the diff
: world
# The files differ
!EXIT_CODE: 1
# The --launcher option allows to prepend something to every command.
# It could be used with valgrind or other tools.
python3 src/should.py --launcher echo demo/cal.should ; true
$ The command is launched with 'echo'
: LANG=C cal 2001
$ The command is not run, several tests do fail
0: January
: failed
# By default, 'should.py' checks the standard output.
# One can also check a given file instead.
!OUTPUT_FILE: hw.txt
echo "hello" > hw.txt
echo "you"
echo "world" >> hw.txt
$ Correct content in 'hw.txt'
bl: hello world
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment