diff options
author | Jim Meyering <meyering@fb.com> | 2013-10-23 13:48:57 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2013-10-23 13:56:22 -0700 |
commit | a181ed9a6778c313dda49b7d7921e4d700bb1d52 (patch) | |
tree | cf605342b190163cb47e595f8d3f095dc4ce4988 /tests/unibyte-bracket-expr | |
parent | 7a35413864e7e557050063a648caa452c38c160b (diff) | |
download | grep-a181ed9a6778c313dda49b7d7921e4d700bb1d52.tar.gz |
tests: port to bourne shells whose printf doesn't grok hex
Use octal escapes, not hex, in printf(1) format strings,
and in one case, use $AWK's printf so we can continue
to use the table of hex values.
* tests/char-class-multibyte: Use printf octal escapes, not hex,
for portability to shells like dash and Solaris 10's /bin/sh.
* tests/backslash-s-vs-invalid-multitype: Likewise.
* tests/surrogate-pair: Likewise.
* tests/unibyte-bracket-expr: Count in decimal and convert to octal.
* tests/multibyte-white-space (hex_printf): New function.
Use it in place of printf so we can retain the table of hex digits
without hitting the limitation of some bourne shells.
Reported by Paul Eggert in http://bugs.gnu.org/15690#11
Diffstat (limited to 'tests/unibyte-bracket-expr')
-rwxr-xr-x | tests/unibyte-bracket-expr | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/unibyte-bracket-expr b/tests/unibyte-bracket-expr index 126a4451..17a431d1 100755 --- a/tests/unibyte-bracket-expr +++ b/tests/unibyte-bracket-expr @@ -27,14 +27,17 @@ export LC_ALL fail=0 -for i in 8 9 a b c d e f; do - for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - in=in-$i$j - b=$(printf "\\x$i$j") - echo "$b" > $in || framework_failure_ - grep "[$b]" $in > out || fail=1 - compare out $in || fail=1 - done +i=128 +while :; do + in=in-$i + octal=$(printf '%03o' $i) + b=$(printf "\\$octal") + echo "$b" > $in || framework_failure_ + grep "[$b]" $in > out || fail=1 + compare out $in || fail=1 + + test $i = 255 && break + i=$(expr $i + 1) done Exit $fail |