summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/foreach-break-2
blob: b1f60407a6aee25cbcecfefcbc542708339bf047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
#  PRE: foreach foreach-break
#

update request {
	Calling-Station-Id := "ABCDEF_8"
}

update control {
	&Tmp-String-0 := "0"
	&Tmp-String-0 += "1"
	&Tmp-String-0 += "2"
	&Tmp-String-0 += "3"
	&Tmp-String-0 += "4"
	&Tmp-String-0 += "5"
	&Tmp-String-0 += "6"
	&Tmp-String-0 += "7"
	&Tmp-String-0 += "8"
	&Tmp-String-0 += "9"
	&Tmp-String-0 += "a"
	&Tmp-String-0 += "b"
	&Tmp-String-0 += "c"
	&Tmp-String-0 += "d"
	&Tmp-String-0 += "e"
	&Tmp-String-0 += "f"
	&Tmp-String-0 += "g"
}

foreach control:Tmp-String-0 {
	if ("%{Calling-Station-Id[*]}" =~ /([A-Z0-9\-]*)_%{Foreach-Variable-0}/) {
		update request {
			Called-Station-Id := "%{1}"
		}
		update reply {
			Filter-Id := "filter"
		}

		break
	}
	elsif ("%{Foreach-Variable-0}" == '9') {
		update reply {
			Filter-Id := "fail-9"
		}
		reject
	}
}