diff options
author | Denys Vlasenko | 2010-03-10 19:20:32 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-03-10 19:20:32 +0100 |
commit | 3cb60c39737208ca073842f4f0386d5e5c278705 (patch) | |
tree | 7e96890a5016885d75dea187edd1c63cbbf05f6a /testsuite | |
parent | eae697fb93362dd51365fdd5283128cb339b91c2 (diff) | |
download | busybox-3cb60c39737208ca073842f4f0386d5e5c278705.zip busybox-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')
-rwxr-xr-x | testsuite/awk.tests | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 03d4649..78f9f0b 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 |