awk: Syntax error if delete isn't given an arg.

Unlike exit and return, delete strictly requires an arg, and derefs a
null pointer if executed without one.

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Brian Foley
2019-01-01 13:40:59 -08:00
committed by Denys Vlasenko
parent dac15a10ac
commit 08a514c097
2 changed files with 20 additions and 10 deletions

View File

@ -336,10 +336,13 @@ testing "awk continue" \
'BEGIN { if (1) continue; else a = 1 }'
testing "awk handles invalid for loop" \
"awk '{ for() }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" ""
"awk -e '{ for() }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" ""
testing "awk handles colon not preceded by ternary" \
"awk 'foo:bar:' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" ""
"awk -e foo:bar: 2>&1" "awk: cmd. line:1: Unexpected token\n" "" ""
testing "awk errors on missing delete arg" \
"awk -e '{delete}' 2>&1" "awk: cmd. line:1: Too few arguments\n" "" ""
# testing "description" "command" "result" "infile" "stdin"
testing 'awk negative field access' \