diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2011-06-20 09:46:06 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-06-20 09:53:20 +0200 |
commit | b970f0a50546e7cc062b0f76df45ae69661b2846 (patch) | |
tree | e07ebed55172c66d75419a7a0b0dbfc1321c5691 | |
parent | 2f60384d6abc787f5c4dfb5e9bffa328265b3028 (diff) | |
download | coreutils-b970f0a50546e7cc062b0f76df45ae69661b2846.tar.xz |
tests: improve init.sh by removing w2_
* tests/init.sh (w2_): Remove, moving contents into...
(warn_): ...here. Call self from subshell when IFS must be changed.
-rw-r--r-- | tests/init.sh | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/init.sh b/tests/init.sh index b8577305b..5878179fc 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -74,19 +74,18 @@ Exit () { set +e; (exit $1); exit $1; } # the reason for skip/failure to console, rather than to the .log files. : ${stderr_fileno_=2} -# Call w2_ only via warn_, since correct expansion of "$*" depends on -# IFS starting with ' '. Always write the full diagnostic to stderr. +# Note that correct expansion of "$*" depends on IFS starting with ' '. +# Always write the full diagnostic to stderr. # When stderr_fileno_ is not 2, also emit the first line of the # diagnostic to that file descriptor. -w2_ () { printf '%s\n' "$*" >&2 - test $stderr_fileno_ = 2 \ - || { printf '%s\n' "$*" | head -1 >&$stderr_fileno_ ; } ; } warn_ () { # If IFS does not start with ' ', set it and emit the warning in a subshell. case $IFS in - ' '*) w2_ "$@";; - *) (IFS=' '; w2_ "$@");; + ' '*) printf '%s\n' "$*" >&2 + test $stderr_fileno_ = 2 \ + || { printf '%s\n' "$*" | head -1 >&$stderr_fileno_ ; } ;; + *) (IFS=' '; warn_ "$@");; esac } fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } |