3 .
"$srcdir/init.sh"; path_prepend_ .
5 # For now, only test with C locale
9 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
10 # does not understand '\r'.
11 if echo solaris |
tr -d '\r' |
grep solais
> /dev
/null
; then
17 # Test with seekable stdin; the follow-on process must see remaining data.
18 tr @
'\177' <<EOF > in.tmp
19 nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - entire line consumed
20 y@n - backspace does not change result
22 does not match either yesexpr or noexpr
35 (${CHECKER} test-yesno
; ${CHECKER} test-yesno
3; cat) < in.tmp
> out1.tmp || fail
=1
36 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
37 cmp xout.tmp out.tmp || fail
=1
39 (${CHECKER} test-yesno
3; ${CHECKER} test-yesno
; cat) < in.tmp
> out1.tmp || fail
=1
40 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
41 cmp xout.tmp out.tmp || fail
=1
43 # Test for behavior on pipe
48 echo yes |
${CHECKER} test-yesno
2 > out1.tmp || fail
=1
49 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
50 cmp xout.tmp out.tmp || fail
=1
52 # Test for behavior with no EOL at EOF
56 printf y |
${CHECKER} test-yesno
1 > out1.tmp || fail
=1
57 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
58 cmp xout.tmp out.tmp || fail
=1
60 # Test for behavior on EOF
64 ${CHECKER} test-yesno
</dev
/null
> out1.tmp || fail
=1
65 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
66 cmp xout.tmp out.tmp || fail
=1
68 # Test for behavior when stdin is closed
69 ${CHECKER} test-yesno
0 <&- > out1.tmp
2> err.tmp
&& fail
=1
70 LC_ALL
=C
tr -d "$cr" < out1.tmp
> out.tmp || fail
=1
71 cmp xout.tmp out.tmp || fail
=1
72 test -s err.tmp || fail
=1