File: test.ia_set2var

package info (click to toggle)
shellia 5.10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: sh: 7,840; makefile: 34
file content (45 lines) | stat: -rwxr-xr-x 1,537 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# vim: set filetype=sh :
#        file: test.ia_set2var
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2024)
#     license: GNU General Public License, version 3
# description: test script to test ia_set2var and ia_set_minus.
#    see also: example.ia_set2var

# The following tests are included:
# (1) Run this script without options

. ./tstlib

quote="'"
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"
cmd=$(dirname $0)/example.ia_set2var

check "(1) Run this script without options" "$@" "$cmd" \
"a=<\"normal\" \"blank blank\" \"doublequote\\\"doublequote\" \"dollar\\\$dollar\" \"newline
newline\" \"backslash\\\\backslash\" \"backquote\\\`backquote\">
b=<\"normal\" \"blank blank\" \"doublequote\\\"doublequote\" \"dollar\\\$dollar\" \"newline
newline\" \"backslash\\\\backslash\" \"backquote\\\`backquote\">
c=<\"normal\" \"blank blank\" \"doublequote\\\"doublequote\" \"dollar\\\$dollar\" \"newline
newline\" \"backslash\\\\backslash\" \"backquote\\\`backquote\">
d=<\"normal\" \"blank blank\" \"doublequote\\\"doublequote\" \"dollar\\\$dollar\" \"newline
newline\" \"backslash\\\\backslash\" \"backquote\\\`backquote\">
ok ia_set2var-1
ok ia_set2var-2
ok ia_set2var-3
e=<\"newline
newline\" \"blank blank\" \"normal\">
f=<\"doublequote\\\"doublequote\" \"dollar\\\$dollar\" \"backslash\\\\backslash\" \"backquote\\\`backquote\">
g=<>
ok ia_set2var-4"