1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#!/bin/sh
# vim: set filetype=sh :
# file: test.hello_world
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2021)
# license: GNU General Public License, version 3
# description: test "hello world" script
# see also: hello_world
# The following tests are included:
# (1) Run without options
# (2) Run interactive
. ./tstlib
shell=""
while [ $# -ne 0 ]; do
if [ "$1" = "-s" ]; then
shell="$2"
shift 2
else
/bin/echo "ERROR $0: unknown option <$1>" >&2
exit 1
fi
done
[ "$shell" ] && set -- "$@" -s "$shell"
cmd="$(dirname $0)/hello_world"
use_locallib
check "(1) Run hello_world without options" "$@" "$cmd" "hello
world"
check "(2) Run hello_world interactive" -i "echo \"
\"" "$@" "$cmd -a -i" \
"=== hello_world.tmp.locallib ===
1 echo \"hello\"
2 echo \"world\"
d ... change dbg: 0
c continue without questions
q quit
? [1]
hello
=== hello_world.tmp.locallib ===
1 echo \"hello\"
2 echo \"world\"
d ... change dbg: 0
q quit
? [2]
world
=== hello_world.tmp.locallib ===
1 echo \"hello\"
2 echo \"world\"
d ... change dbg: 0
q quit
? [q] "
|