aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-01-27 11:19:14 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2021-02-02 13:51:14 +0100
commite8fe9f96356a6b19ec907ea30cffc829c539a7ff (patch)
tree1c9450cbdc4c32266241652303852acde28c14a0 /testsuite
parentf3a55b306ed3803133ab028b72b255c65d94197f (diff)
downloadbusybox-w32-e8fe9f96356a6b19ec907ea30cffc829c539a7ff.tar.gz
busybox-w32-e8fe9f96356a6b19ec907ea30cffc829c539a7ff.tar.bz2
busybox-w32-e8fe9f96356a6b19ec907ea30cffc829c539a7ff.zip
awk: allow printf('%c') to output NUL, closes 13486
Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests5
1 files changed, 5 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 92c83d719..cf9b722dc 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -383,6 +383,11 @@ testing "awk errors on missing delete arg" \
383 "awk -e '{delete}' 2>&1" "awk: cmd. line:1: Too few arguments\n" "" "" 383 "awk -e '{delete}' 2>&1" "awk: cmd. line:1: Too few arguments\n" "" ""
384SKIP= 384SKIP=
385 385
386optional FEATURE_AWK_GNU_EXTENSIONS
387testing "awk printf('%c') can output NUL" \
388 "awk '{printf(\"hello%c null\n\", 0)}'" "hello\0 null\n" "" "\n"
389SKIP=
390
386# testing "description" "command" "result" "infile" "stdin" 391# testing "description" "command" "result" "infile" "stdin"
387testing 'awk negative field access' \ 392testing 'awk negative field access' \
388 'awk 2>&1 -- '\''{ $(-1) }'\' \ 393 'awk 2>&1 -- '\''{ $(-1) }'\' \