File: test.redo

package info (click to toggle)
shellia 5.3.2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 412 kB
  • sloc: sh: 3,235; makefile: 32
file content (41 lines) | stat: -rwxr-xr-x 1,383 bytes parent folder | download
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
#!/bin/sh
# vim: set filetype=sh :
#        file: example.redo
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2019)
#     license: GNU General Public License, version 3
# description: test interactive redo option 
#              with a command that needs to run 3 times until it succeeds
#    see also: example.func

# The following tests are included:
# (1) Run only with -a option

. ./tstlib

shell=""
while [ $# -ne 0 ]; do
  if [ "$1" = "-s" ]; then
    shell="$2"
    shift 2
  else
    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="./example.redo"
bug913718_cmd

check "(1) Run only with -a option" -i "/bin/echo \"r
r
\"" "$@" "$cmd -a" \
"--- output with ERROR from <example.redo> running <i=\"\$(cat \$TMPFILE)\"; if ! [ \"\$i\" = \"3\" ]; then echo \"i=\$i retry until i=3\"; i=\$((i+1)); echo \"\$i\" >\$TMPFILE; else echo \"ok i=3\"; fi> ---
e:i=1 retry until i=3
--- (q)uit (r)edo (i)gnore (s)witch interactive ---
? --- output with ERROR from <example.redo> running <i=\"\$(cat \$TMPFILE)\"; if ! [ \"\$i\" = \"3\" ]; then echo \"i=\$i retry until i=3\"; i=\$((i+1)); echo \"\$i\" >\$TMPFILE; else echo \"ok i=3\"; fi> ---
e:i=2 retry until i=3
--- (q)uit (r)edo (i)gnore (s)witch interactive ---
? ok i=3"