From 405c640f5b337b05d53c03432039c3417cbd14a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 8 Jul 2004 14:03:20 +0000 Subject: printf cleanup, to avoid undefined behavior, to add support for formats that Bash supports, and to support wide integers like Bash does. Add tests for the above. --- tests/misc/printf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/misc/printf') diff --git a/tests/misc/printf b/tests/misc/printf index 431e685da..64d16f336 100755 --- a/tests/misc/printf +++ b/tests/misc/printf @@ -63,6 +63,20 @@ $prog '7 \2y \02y \002y \0002y\n' |tr '\0\2' '*=' >> out $prog '8 %b %b %b %b\n' '\1y' '\01y' '\001y' '\0001y'|tr '\1' = >> out +$prog '9 %*dx\n' -2 0 >>out || fail=1 + +$prog '10 %.*dx\n' -2147483648 0 >>out || fail=1 + +$prog '11 %*c\n' 2 x >>out || fail=1 + +$prog '%#d\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%0s\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%.9c\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%'\''s\n' 0 >>out 2> /dev/null && fail=1 + cat <<\EOF > exp 1 x y 2 failed, as expected @@ -72,6 +86,9 @@ cat <<\EOF > exp 6 ! 7 =y =y =y *2y 8 =y =y =y =y +9 0 x +10 0x +11 x EOF cmp out exp || fail=1 -- cgit v1.2.3-70-g09d2