From 758c2bd58e0a23cdf19be8bd7c963074aff54b50 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 4 Dec 2020 19:00:06 +0100 Subject: awk: add a test that $NF is empty Signed-off-by: Denys Vlasenko --- testsuite/awk.tests | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'testsuite') 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 -- cgit v1.2.3