Skip to content

Commit f801798

Browse files
committed
update to use new syntax
and to note that we can't delete things while we're looping over them. We may relax that restriction later
1 parent 0e99af7 commit f801798

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

src/tests/keywords/return-break-mix

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,41 @@ control += {
88
NAS-Port = 3
99
}
1010

11-
foreach control.NAS-Port {
11+
foreach thing (control.NAS-Port[*]) {
12+
#
13+
# Test where a "return" in a policy will stop exection
14+
# of the caller.
15+
#
1216
policy_return
1317

1418
# Should continue executing
15-
if ("%{Foreach-Variable-0}" == '2') {
19+
if (thing == 2) {
1620
break
1721
}
1822

19-
control -= {
20-
NAS-Port == "%{Foreach-Variable-0}"
21-
}
23+
thing += 7
2224
}
2325

24-
# Everything should have been removed except
25-
# the last incidence of NAS-Port
26-
if (!control.NAS-Port) {
26+
#
27+
# 0, and 1 should have been updated. 2 and 3 are left alone.
28+
#
29+
if (control.NAS-Port[#] != 4) {
2730
test_fail
2831
}
29-
if (!(control.NAS-Port[0] == 2)) {
32+
33+
if (control.NAS-Port[0] != 7) {
34+
test_fail
35+
}
36+
37+
if (control.NAS-Port[1] != 8) {
38+
test_fail
39+
}
40+
41+
if (control.NAS-Port[2] != 2) {
42+
test_fail
43+
}
44+
45+
if (control.NAS-Port[3] != 3) {
3046
test_fail
3147
}
3248

0 commit comments

Comments
 (0)