diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-04 19:00:06 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-04 19:00:06 +0100 |
commit | 758c2bd58e0a23cdf19be8bd7c963074aff54b50 (patch) | |
tree | de24deba31f3116329a5d634e34185b0d32a6610 | |
parent | f4f6e5144b9af71dc687dc14dba4a6caf8c28361 (diff) | |
download | busybox-w32-758c2bd58e0a23cdf19be8bd7c963074aff54b50.tar.gz busybox-w32-758c2bd58e0a23cdf19be8bd7c963074aff54b50.tar.bz2 busybox-w32-758c2bd58e0a23cdf19be8bd7c963074aff54b50.zip |
awk: add a test that $NF is empty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | testsuite/awk.tests | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 06a531d96..92c83d719 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests | |||
@@ -398,12 +398,19 @@ testing 'awk do not allow "str"++' \ | |||
398 | '' \ | 398 | '' \ |
399 | 'anything' | 399 | 'anything' |
400 | 400 | ||
401 | #gawk compat: FS regex matches only non-empty separators: | 401 | # gawk compat: FS regex matches only non-empty separators: |
402 | #with -*, the splitting is NOT f o o b a r, but foo bar: | 402 | # with -*, the splitting is NOT f o o b a r, but foo bar: |
403 | testing 'awk FS regex which can match empty string' \ | 403 | testing 'awk FS regex which can match empty string' \ |
404 | "awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \ | 404 | "awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \ |
405 | "foo-bar=*\n" \ | 405 | "foo-bar=*\n" \ |
406 | '' \ | 406 | '' \ |
407 | 'foo--bar' | 407 | 'foo--bar' |
408 | 408 | ||
409 | # last+1 field should be empty (had a bug where it wasn't) | ||
410 | testing 'awk $NF is empty' \ | ||
411 | "awk -F '=+' '{print \$NF}'" \ | ||
412 | "\n" \ | ||
413 | '' \ | ||
414 | 'a=====123=' | ||
415 | |||
409 | exit $FAILCOUNT | 416 | exit $FAILCOUNT |