aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-07-17 10:35:24 +0100
committerRon Yorston <rmy@pobox.com>2021-07-17 10:35:24 +0100
commit36e9606c1d1edfbc9e4eba31b4c498dba361ac98 (patch)
tree492a436d5fba5a545e7155a115679e0669e9bed6 /testsuite
parentdcca23dc4cf9b51a1c2576360fea190e9b71204e (diff)
parentdabbeeb79356eef78528acd55e1f143ae80372f7 (diff)
downloadbusybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.tar.gz
busybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.tar.bz2
busybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests27
1 files changed, 20 insertions, 7 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 770d8ffce..f53b1efe2 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -379,19 +379,14 @@ testing "awk -e and ARGC" \
379 "" 379 ""
380SKIP= 380SKIP=
381 381
382# The examples are in fact not valid awk programs (break/continue
383# can only be used inside loops).
384# But we do accept them outside of loops.
385# We had a bug with misparsing "break ; else" sequence.
386# Test that *that* bug is fixed, using simplest possible scripts:
387testing "awk break" \ 382testing "awk break" \
388 "awk -f - 2>&1; echo \$?" \ 383 "awk -f - 2>&1; echo \$?" \
389 "0\n" \ 384 "awk: -:1: 'break' not in a loop\n1\n" \
390 "" \ 385 "" \
391 'BEGIN { if (1) break; else a = 1 }' 386 'BEGIN { if (1) break; else a = 1 }'
392testing "awk continue" \ 387testing "awk continue" \
393 "awk -f - 2>&1; echo \$?" \ 388 "awk -f - 2>&1; echo \$?" \
394 "0\n" \ 389 "awk: -:1: 'continue' not in a loop\n1\n" \
395 "" \ 390 "" \
396 'BEGIN { if (1) continue; else a = 1 }' 391 'BEGIN { if (1) continue; else a = 1 }'
397 392
@@ -415,6 +410,14 @@ testing "awk printf('%c') can output NUL" \
415 "awk '{printf(\"hello%c null\n\", 0)}'" "hello\0 null\n" "" "\n" 410 "awk '{printf(\"hello%c null\n\", 0)}'" "hello\0 null\n" "" "\n"
416SKIP= 411SKIP=
417 412
413optional FEATURE_AWK_GNU_EXTENSIONS
414testing "awk printf('%-10c') can output NUL" \
415 "awk 'BEGIN { printf \"[%-10c]\n\", 0 }' | od -tx1" "\
4160000000 5b 00 20 20 20 20 20 20 20 20 20 5d 0a
4170000015
418" "" ""
419SKIP=
420
418# testing "description" "command" "result" "infile" "stdin" 421# testing "description" "command" "result" "infile" "stdin"
419testing 'awk negative field access' \ 422testing 'awk negative field access' \
420 'awk 2>&1 -- '\''{ $(-1) }'\' \ 423 'awk 2>&1 -- '\''{ $(-1) }'\' \
@@ -450,4 +453,14 @@ testing "awk exit N propagates through END's exit" \
450 "42\n" \ 453 "42\n" \
451 '' '' 454 '' ''
452 455
456testing "awk print + redirect" \
457 "awk 'BEGIN { print \"STDERR %s\" >\"/dev/stderr\" }' 2>&1" \
458 "STDERR %s\n" \
459 '' ''
460
461testing "awk \"cmd\" | getline" \
462 "awk 'BEGIN { \"echo HELLO\" | getline; print }'" \
463 "HELLO\n" \
464 '' ''
465
453exit $FAILCOUNT 466exit $FAILCOUNT