aboutsummaryrefslogtreecommitdiff
path: root/tests/printf.test
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-01-10 20:02:21 -0600
committerRob Landley <rob@landley.net>2015-01-10 20:02:21 -0600
commit70cbfe8eda34df26cc91c51cd77098612e33fd80 (patch)
tree216b5b351540f8b829824e54ef42e047f1d1f9c1 /tests/printf.test
parentdd2cc65fdffad9820b2c1ab1d16309a91af8f579 (diff)
downloadtoybox-70cbfe8eda34df26cc91c51cd77098612e33fd80.tar.gz
More half-finished cleanup of printf.c, and more test suite entries.
Diffstat (limited to 'tests/printf.test')
-rw-r--r--tests/printf.test10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/printf.test b/tests/printf.test
index ded169e4..7b4b821d 100644
--- a/tests/printf.test
+++ b/tests/printf.test
@@ -21,7 +21,7 @@ testing "printf octal" "$PRINTF ' \1\002\429\045x'" ' \001\002"9%x' "" ""
testing "printf not octal" "$PRINTF '\9'" '\9' "" ""
testing "printf hex" "$PRINTF 'A\x1b\x2B\x3Q\xa' | od -An -tx1" \
' 41 1b 2b 03 51 0a\n' "" ""
-testing "printf " "$PRINTF '%x\n' 0x2a" "2a\n" "" ""
+testing "printf %x" "$PRINTF '%x\n' 0x2a" "2a\n" "" ""
testing "printf %d 42" "$PRINTF %d 42" "42" "" ""
testing "printf %d 0x2a" "$PRINTF %d 0x2a" "42" "" ""
@@ -31,6 +31,14 @@ testing "printf %s width precision" \
"$PRINTF '%3s,%.3s,%10s,%10.3s' abcde fghij klmno pqrst" \
"abcde,fgh, klmno, pqr" "" ""
+# posix: "The format operand shall be reused as often as necessary to satisfy
+# the argument operands."
+
+testing "printf extra args" "$PRINTF 'abc%s!%ddef\n' X 42 ARG 36" \
+ "abcX!42def\nabcARG!36def\n" "" ""
+
+testing "printf '%3c'" "printf '%3c' x" " x" "" ""
+
testing "printf '%5d%4d' 1 21 321 4321 54321" \
"$PRINTF '%5d%4d' 1 21 321 4321 54321" " 1 21 321432154321 0" "" ""
testing "printf '%c %c' 78 79" "$PRINTF '%c %c' 78 79" "7 7" "" ""