diff options
author | Ron Yorston <rmy@pobox.com> | 2021-07-17 10:35:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-07-17 10:35:24 +0100 |
commit | 36e9606c1d1edfbc9e4eba31b4c498dba361ac98 (patch) | |
tree | 492a436d5fba5a545e7155a115679e0669e9bed6 /testsuite | |
parent | dcca23dc4cf9b51a1c2576360fea190e9b71204e (diff) | |
parent | dabbeeb79356eef78528acd55e1f143ae80372f7 (diff) | |
download | busybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.tar.gz busybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.tar.bz2 busybox-w32-36e9606c1d1edfbc9e4eba31b4c498dba361ac98.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/awk.tests | 27 |
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 | "" |
380 | SKIP= | 380 | SKIP= |
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: | ||
387 | testing "awk break" \ | 382 | testing "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 }' |
392 | testing "awk continue" \ | 387 | testing "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" |
416 | SKIP= | 411 | SKIP= |
417 | 412 | ||
413 | optional FEATURE_AWK_GNU_EXTENSIONS | ||
414 | testing "awk printf('%-10c') can output NUL" \ | ||
415 | "awk 'BEGIN { printf \"[%-10c]\n\", 0 }' | od -tx1" "\ | ||
416 | 0000000 5b 00 20 20 20 20 20 20 20 20 20 5d 0a | ||
417 | 0000015 | ||
418 | " "" "" | ||
419 | SKIP= | ||
420 | |||
418 | # testing "description" "command" "result" "infile" "stdin" | 421 | # testing "description" "command" "result" "infile" "stdin" |
419 | testing 'awk negative field access' \ | 422 | testing '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 | ||
456 | testing "awk print + redirect" \ | ||
457 | "awk 'BEGIN { print \"STDERR %s\" >\"/dev/stderr\" }' 2>&1" \ | ||
458 | "STDERR %s\n" \ | ||
459 | '' '' | ||
460 | |||
461 | testing "awk \"cmd\" | getline" \ | ||
462 | "awk 'BEGIN { \"echo HELLO\" | getline; print }'" \ | ||
463 | "HELLO\n" \ | ||
464 | '' '' | ||
465 | |||
453 | exit $FAILCOUNT | 466 | exit $FAILCOUNT |