aboutsummaryrefslogtreecommitdiff
path: root/testsuite
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
parenteae697fb93362dd51365fdd5283128cb339b91c2 (diff)
downloadbusybox-w32-3cb60c39737208ca073842f4f0386d5e5c278705.tar.gz
busybox-w32-3cb60c39737208ca073842f4f0386d5e5c278705.tar.bz2
busybox-w32-3cb60c39737208ca073842f4f0386d5e5c278705.zip
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')
-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)" \
67testing "awk handles whitespace before array subscript" \ 67testing "awk handles whitespace before array subscript" \
68 "awk 'BEGIN { arr [3] = 1; print arr [3] }'" "1\n" "" "" 68 "awk 'BEGIN { arr [3] = 1; print arr [3] }'" "1\n" "" ""
69 69
70prg='
71BEGIN {
72 v["q"]=1
73 v["w"]=1
74 v["e"]=1
75 for (l in v) {
76 print "outer1", l;
77 for (l in v) {
78 print " inner", l;
79 }
80 print "outer2", l;
81 }
82 print "end", l;
83 l="a"
84 exit;
85}'
86testing "awk nested loops with the same variable" \
87 "awk '$prg'" \
88 "\
89outer1 e
90 inner e
91 inner q
92 inner w
93outer2 w
94outer1 q
95 inner e
96 inner q
97 inner w
98outer2 w
99outer1 w
100 inner e
101 inner q
102 inner w
103outer2 w
104end w
105" \
106 "" ""
107
70exit $FAILCOUNT 108exit $FAILCOUNT