summaryrefslogtreecommitdiff
path: root/testsuite/printf.tests
diff options
context:
space:
mode:
authorDaniel Thau2021-09-02 07:41:08 -0400
committerDenys Vlasenko2021-09-05 03:42:51 +0200
commit7d06d6e18651cb183a3723fa21ef62935ea08647 (patch)
tree29a36fb92c34c697ca6e0c21d5cdc4edf26484d3 /testsuite/printf.tests
parentf4ba69d47698c5357c32e21eb9122a5031b9b080 (diff)
downloadbusybox-7d06d6e18651cb183a3723fa21ef62935ea08647.zip
busybox-7d06d6e18651cb183a3723fa21ef62935ea08647.tar.gz
awk: fix printf %%
A refactor of the awk printf code in e2e3802987266c98df0efdf40ad5da4b07df0113 appears to have broken the printf interpretation of two percent signs, which normally outputs only one percent sign. The patch below brings busybox awk printf behavior back into alignment with the pre-e2e380 behavior, the busybox printf util, and other common (awk and non-awk) printf implementations. function old new delta awk_printf 626 672 +46 Signed-off-by: Daniel Thau <danthau at bedrocklinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/printf.tests')
-rwxr-xr-xtestsuite/printf.tests5
1 files changed, 5 insertions, 0 deletions
diff --git a/testsuite/printf.tests b/testsuite/printf.tests
index 34a6592..050edef 100755
--- a/testsuite/printf.tests
+++ b/testsuite/printf.tests
@@ -79,6 +79,11 @@ testing "printf understands %Ld" \
"-5\n""0\n" \
"" ""
+testing "printf understands %%" \
+ "${bb}printf '%%\n' 2>&1; echo \$?" \
+ "%\n""0\n" \
+ "" ""
+
testing "printf handles positive numbers for %d" \
"${bb}printf '%d\n' 3 +3 ' 3' ' +3' 2>&1; echo \$?" \
"3\n"\