X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-yesno.sh;h=52b94ef05b9f170a99bd62b3110c2b782bc178da;hb=1cf34fafe06c511eb2cb328fe6d68a09e9c72ead;hp=fdf99480064f1b4a92174756c8e5a1e74675644d;hpb=1cf55d294e17922d56dc703d66fd699f67db7073;p=gnulib.git diff --git a/tests/test-yesno.sh b/tests/test-yesno.sh index fdf994800..52b94ef05 100755 --- a/tests/test-yesno.sh +++ b/tests/test-yesno.sh @@ -4,13 +4,21 @@ tmpfiles= trap 'rm -fr $tmpfiles' 1 2 3 15 p=t-yesno- -tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out.tmp" +tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out.tmp ${p}err.tmp" # For now, only test with C locale LC_ALL=C export LC_ALL -# Test with seekable stdin; followon process must see remaining data +# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr +# does not understand '\r'. +if echo solaris | tr -d '\r' | grep solais > /dev/null; then + cr='\015' +else + cr='\r' +fi + +# Test with seekable stdin; the followon process must see remaining data. cat < ${p}in.tmp nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - entire line consumed yn - backspace does not change result @@ -18,6 +26,7 @@ y does not match either yesexpr or noexpr n EOF + cat < ${p}xout.tmp N Y @@ -25,12 +34,15 @@ Y N n EOF + (./test-yesno${EXEEXT}; ./test-yesno${EXEEXT} 3; cat) \ - < ${p}in.tmp > ${p}out.tmp || exit 1 + < ${p}in.tmp > ${p}out1.tmp || exit 1 +LC_ALL=C tr -d "$cr" < ${p}out1.tmp > ${p}out.tmp || exit 1 cmp ${p}xout.tmp ${p}out.tmp || exit 1 (./test-yesno${EXEEXT} 3; ./test-yesno${EXEEXT}; cat) \ - < ${p}in.tmp > ${p}out.tmp || exit 1 + < ${p}in.tmp > ${p}out1.tmp || exit 1 +LC_ALL=C tr -d "$cr" < ${p}out1.tmp > ${p}out.tmp || exit 1 cmp ${p}xout.tmp ${p}out.tmp || exit 1 # Test for behavior on pipe @@ -38,19 +50,23 @@ cat < ${p}xout.tmp Y N EOF -echo yes | ./test-yesno${EXEEXT} 2 > ${p}out.tmp || exit 1 +echo yes | ./test-yesno${EXEEXT} 2 > ${p}out1.tmp || exit 1 +LC_ALL=C tr -d "$cr" < ${p}out1.tmp > ${p}out.tmp || exit 1 cmp ${p}xout.tmp ${p}out.tmp || exit 1 # Test for behavior on EOF cat < ${p}xout.tmp N EOF -./test-yesno${EXEEXT} ${p}out.tmp || exit 1 +./test-yesno${EXEEXT} ${p}out1.tmp || exit 1 +LC_ALL=C tr -d "$cr" < ${p}out1.tmp > ${p}out.tmp || exit 1 cmp ${p}xout.tmp ${p}out.tmp || exit 1 # Test for behavior when stdin is closed -./test-yesno${EXEEXT} 0 <&- > ${p}out.tmp && exit 1 +./test-yesno${EXEEXT} 0 <&- > ${p}out1.tmp 2> ${p}err.tmp && exit 1 +LC_ALL=C tr -d "$cr" < ${p}out1.tmp > ${p}out.tmp || exit 1 cmp ${p}xout.tmp ${p}out.tmp || exit 1 +test -s ${p}err.tmp || exit 1 # Cleanup rm -fr $tmpfiles