awk: add a test that $NF is empty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
f4f6e5144b
commit
758c2bd58e
@ -398,12 +398,19 @@ testing 'awk do not allow "str"++' \
|
|||||||
'' \
|
'' \
|
||||||
'anything'
|
'anything'
|
||||||
|
|
||||||
#gawk compat: FS regex matches only non-empty separators:
|
# gawk compat: FS regex matches only non-empty separators:
|
||||||
#with -*, the splitting is NOT f o o b a r, but foo bar:
|
# with -*, the splitting is NOT f o o b a r, but foo bar:
|
||||||
testing 'awk FS regex which can match empty string' \
|
testing 'awk FS regex which can match empty string' \
|
||||||
"awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \
|
"awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \
|
||||||
"foo-bar=*\n" \
|
"foo-bar=*\n" \
|
||||||
'' \
|
'' \
|
||||||
'foo--bar'
|
'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
|
exit $FAILCOUNT
|
||||||
|
Loading…
Reference in New Issue
Block a user