summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko2014-06-26 16:40:28 +0200
committerDenys Vlasenko2014-06-26 16:40:28 +0200
commit5f8daefb835687e428215f90d26fdf1f0206149d (patch)
treeb42723b59183e1bcf6196b37b34113d5a843fabb /testsuite
parent0b0ccd457016d6a4eaa3e79bd65a852ea7d4294b (diff)
downloadbusybox-5f8daefb835687e428215f90d26fdf1f0206149d.zip
busybox-5f8daefb835687e428215f90d26fdf1f0206149d.tar.gz
awk: fix handling of "if ... break ; else ..." - closes 7226
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 132afc6..9e6952f 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -295,6 +295,22 @@ testing "awk -e and ARGC" \
""
SKIP=
+# The examples are in fact not valid awk programs (break/continue
+# can only be used inside loops).
+# But we do accept them outside of loops.
+# We had a bug with misparsing "break ; else" sequence.
+# Test that *that* bug is fixed, using simplest possible scripts:
+testing "awk break" \
+ "awk -f - 2>&1; echo \$?" \
+ "0\n" \
+ "" \
+ 'BEGIN { if (1) break; else a = 1 }'
+testing "awk continue" \
+ "awk -f - 2>&1; echo \$?" \
+ "0\n" \
+ "" \
+ 'BEGIN { if (1) continue; else a = 1 }'
+
# testing "description" "command" "result" "infile" "stdin"
exit $FAILCOUNT