[git commit] awk: add a test that $NF is empty
Denys Vlasenko
vda.linux at googlemail.com
Fri Dec 4 18:00:06 UTC 2020
commit: https://git.busybox.net/busybox/commit/?id=758c2bd58e0a23cdf19be8bd7c963074aff54b50
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
testsuite/awk.tests | 11 +++++++++--
1 file 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
More information about the busybox-cvs
mailing list