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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#!/bin/sh
# vim: set filetype=sh :
# file: test.backslash
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2021)
# license: GNU General Public License, version 3
# description: check correct output of " in interactive menu and in logfile
# see also: example.backslash
# The following tests are included:
# (1) Run with -i
# (2) check logfile
# (3) Run with ia.interactive lib
. ./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"
bug913718_unify UNIFY_posh
[ "$shell" = "posh" ] && set -- "$@" -u "$UNIFY_posh"
cmd=$(dirname $0)/example.backslash
bug913718_cmd
ia_logfile="$(mktemp)"
export ia_logfile
rm -f $ia_logfile
check "(1) Run with -i" -i "/bin/echo \"c
\"" "$@" "$cmd -a -i" \
"=== example.backslash ===
1 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
2 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
d ... change dbg: 0
c continue without questions
q quit
? [1]
1=<one two> 2=<three>
1=<one two> 2=<three>"
check "(2) check logfile" "$@" "cat $ia_logfile" \
"|=== example.backslash ===
|1 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
|2 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
|d ... change dbg: 0
|c continue without questions
|q quit
|? [1] c<RETURN>"
cmd=$(dirname $0)/example.backslash.tmp.only_interactive
cat $(dirname $0)/example.backslash | sed -e "s/^. .\/.*/. .\/ia.interactive/" > $cmd
chmod 755 $cmd
rm -f $ia_logfile
check "(3) Run with ia.interactive lib" -i "/bin/echo \"c
\"" "$@" "$cmd -a -i" \
"=== example.backslash.tmp.only_interactive ===
1 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
2 eval \"set \\\"one two\\\" \\\"three\\\"; /bin/echo \\\"1=<\\\$1> 2=<\\\$2>\\\"\"
c continue without questions
q quit
? [1]
1=<one two> 2=<three>
1=<one two> 2=<three>"
|