1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 # test suite contribution from Martijn Dekker
17 set -o errexit -o noglob
18 (set -o pipefail) 2>/dev/null && set -o pipefail
19 teststring=$(printf '\1\2\3\177')
23 od -t a | sed -n '1 { s/^0*[[:blank:]]*//; s/[[:blank:]]*$//; p; }'
29 case ${IFS+s}${IFS:+n} in
30 ( sn ) i=$(printf %s "$IFS" | trim_od) ;;
33 ( * ) echo 'internal error!' >&2; exit 125 ;;
35 printf '\n%03d: IFS = %s: %s\n' "$((n+=1))" "$i" "$testcmd"
36 printf %s "$*${foo+/}${foo-}" | trim_od
41 'unset -v foo; set -- ${foo=$*}' \
42 'unset -v foo; set -- ${foo="$*"}' \
43 'unset -v foo; set -- "${foo=$*}"' \
45 'foo=; set -- ${foo:=$*}' \
46 'foo=; set -- ${foo:="$*"}' \
47 'foo=; set -- "${foo:=$*}"' \
49 'unset -v foo; set -- ${foo=$@}' \
50 'unset -v foo; set -- ${foo="$@"}' \
51 'unset -v foo; set -- "${foo=$@}"' \
53 'foo=; set -- ${foo:=$@}' \
54 'foo=; set -- ${foo:="$@"}' \
55 'foo=; set -- "${foo:=$@}"'
61 unset -v IFS; doAllTests
64 IFS=$defaultIFS; doAllTests