diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-10 19:20:32 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-10 19:20:32 +0100 |
commit | 3cb60c39737208ca073842f4f0386d5e5c278705 (patch) | |
tree | 7e96890a5016885d75dea187edd1c63cbbf05f6a /testsuite | |
parent | eae697fb93362dd51365fdd5283128cb339b91c2 (diff) | |
download | busybox-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-x | testsuite/awk.tests | 38 |
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)" \ | |||
67 | testing "awk handles whitespace before array subscript" \ | 67 | testing "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 | ||
70 | prg=' | ||
71 | BEGIN { | ||
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 | }' | ||
86 | testing "awk nested loops with the same variable" \ | ||
87 | "awk '$prg'" \ | ||
88 | "\ | ||
89 | outer1 e | ||
90 | inner e | ||
91 | inner q | ||
92 | inner w | ||
93 | outer2 w | ||
94 | outer1 q | ||
95 | inner e | ||
96 | inner q | ||
97 | inner w | ||
98 | outer2 w | ||
99 | outer1 w | ||
100 | inner e | ||
101 | inner q | ||
102 | inner w | ||
103 | outer2 w | ||
104 | end w | ||
105 | " \ | ||
106 | "" "" | ||
107 | |||
70 | exit $FAILCOUNT | 108 | exit $FAILCOUNT |