aboutsummaryrefslogtreecommitdiff
path: root/testsuite/awk.tests
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-10 19:20:32 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-10 19:20:32 +0100
commit3cb60c39737208ca073842f4f0386d5e5c278705 (patch)
tree7e96890a5016885d75dea187edd1c63cbbf05f6a /testsuite/awk.tests
parenteae697fb93362dd51365fdd5283128cb339b91c2 (diff)
downloadbusybox-3cb60c39737208ca073842f4f0386d5e5c278705.tar.gz
awk: fix the case where nested "for" loops with the same variable misbehave
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/awk.tests')
-rwxr-xr-xtestsuite/awk.tests38
1 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 03d464969..78f9f0b98 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -67,4 +67,42 @@ testing "awk string cast (bug 725)" \
testing "awk handles whitespace before array subscript" \
"awk 'BEGIN { arr [3] = 1; print arr [3] }'" "1\n" "" ""
+prg='
+BEGIN {
+ v["q"]=1
+ v["w"]=1
+ v["e"]=1
+ for (l in v) {
+ print "outer1", l;
+ for (l in v) {
+ print " inner", l;
+ }
+ print "outer2", l;
+ }
+ print "end", l;
+ l="a"
+ exit;
+}'
+testing "awk nested loops with the same variable" \
+ "awk '$prg'" \
+ "\
+outer1 e
+ inner e
+ inner q
+ inner w
+outer2 w
+outer1 q
+ inner e
+ inner q
+ inner w
+outer2 w
+outer1 w
+ inner e
+ inner q
+ inner w
+outer2 w
+end w
+" \
+ "" ""
+
exit $FAILCOUNT