Mercurial > gnulib
annotate tests/test-yesno.sh @ 40231:9b3c79fdfe0b
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 11 Mar 2019 16:40:29 -0700 |
parents | 8c1a17df67e0 |
children |
rev | line source |
---|---|
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
1 #!/bin/sh |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
2 : ${srcdir=.} |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
3 . "$srcdir/init.sh"; path_prepend_ . |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
4 |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
5 # For now, only test with C locale |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
6 LC_ALL=C |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
7 export LC_ALL |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
8 |
9987
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
9 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
10 # does not understand '\r'. |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
11 if echo solaris | tr -d '\r' | grep solais > /dev/null; then |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
12 cr='\015' |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
13 else |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
14 cr='\r' |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
15 fi |
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
16 |
16358 | 17 # Test with seekable stdin; the follow-on process must see remaining data. |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
18 tr @ '\177' <<EOF > in.tmp |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
19 nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - entire line consumed |
12078
3710e1c3943e
test-yesno: work around sparc-dash here-document infelicity
Jim Meyering <meyering@redhat.com>
parents:
9987
diff
changeset
|
20 y@n - backspace does not change result |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
21 y |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
22 does not match either yesexpr or noexpr |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
23 n |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
24 EOF |
9987
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
25 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
26 cat <<EOF > xout.tmp |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
27 N |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
28 Y |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
29 Y |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
30 N |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
31 n |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
32 EOF |
9987
8d1cd7ae4b1e
Make test-yesno.sh work on mingw.
Bruno Haible <bruno@clisp.org>
parents:
9391
diff
changeset
|
33 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
34 fail=0 |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
35 (${CHECKER} test-yesno; ${CHECKER} test-yesno 3; cat) < in.tmp > out1.tmp || fail=1 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
36 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
37 cmp xout.tmp out.tmp || fail=1 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
38 |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
39 (${CHECKER} test-yesno 3; ${CHECKER} test-yesno; cat) < in.tmp > out1.tmp || fail=1 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
40 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
41 cmp xout.tmp out.tmp || fail=1 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
42 |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
43 # Test for behavior on pipe |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
44 cat <<EOF > xout.tmp |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
45 Y |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
46 N |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
47 EOF |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
48 echo yes | ${CHECKER} test-yesno 2 > out1.tmp || fail=1 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
49 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
50 cmp xout.tmp out.tmp || fail=1 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
51 |
17948
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
52 # Test for behavior with no EOL at EOF |
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
53 cat <<EOF > xout.tmp |
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
54 Y |
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
55 EOF |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
56 printf y | ${CHECKER} test-yesno 1 > out1.tmp || fail=1 |
17948
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
57 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
58 cmp xout.tmp out.tmp || fail=1 |
88a13cbc41e7
yesno: make EOL optional in ENABLE_NLS case also
Tobias Stoeckmann <tobias@stoeckmann.org>
parents:
16358
diff
changeset
|
59 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
60 # Test for behavior on EOF |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
61 cat <<EOF > xout.tmp |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
62 N |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
63 EOF |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
64 ${CHECKER} test-yesno </dev/null > out1.tmp || fail=1 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
65 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
66 cmp xout.tmp out.tmp || fail=1 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
67 |
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
68 # Test for behavior when stdin is closed |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
17948
diff
changeset
|
69 ${CHECKER} test-yesno 0 <&- > out1.tmp 2> err.tmp && fail=1 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
70 LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
71 cmp xout.tmp out.tmp || fail=1 |
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
72 test -s err.tmp || fail=1 |
9157
18308c6e516b
Test yesno in combination with closein.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
73 |
14821
c47783837720
yesno-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
12078
diff
changeset
|
74 Exit $fail |