diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-04 21:00:06 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-04 21:00:06 +0300 |
commit | 758c2bd58e0a23cdf19be8bd7c963074aff54b50 (patch) | |
tree | de24deba31f3116329a5d634e34185b0d32a6610 /testsuite | |
parent | f4f6e5144b9af71dc687dc14dba4a6caf8c28361 (diff) |
awk: add a test that $NF is empty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-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"++' \ '' \ 'anything' -#gawk compat: FS regex matches only non-empty separators: -#with -*, the splitting is NOT f o o b a r, but foo bar: +# gawk compat: FS regex matches only non-empty separators: +# with -*, the splitting is NOT f o o b a r, but foo bar: testing 'awk FS regex which can match empty string' \ "awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \ "foo-bar=*\n" \ '' \ 'foo--bar' +# last+1 field should be empty (had a bug where it wasn't) +testing 'awk $NF is empty' \ + "awk -F '=+' '{print \$NF}'" \ + "\n" \ + '' \ + 'a=====123=' + exit $FAILCOUNT |