summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-07-08 14:03:20 +0000
committerJim Meyering <jim@meyering.net>2004-07-08 14:03:20 +0000
commit405c640f5b337b05d53c03432039c3417cbd14a4 (patch)
treec90fa8834ccf552ba2d7f21b07bca98a9987c30e
parent3f6161568104c2ceb893a7beb88bd18293bdea91 (diff)
downloadcoreutils-405c640f5b337b05d53c03432039c3417cbd14a4.tar.xz
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.
-rwxr-xr-xtests/misc/printf17
1 files changed, 17 insertions, 0 deletions
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