]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use control.[x]
authorAlan T. DeKok <aland@freeradius.org>
Tue, 22 Nov 2022 13:41:50 +0000 (08:41 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 22 Nov 2022 13:41:50 +0000 (08:41 -0500)
and change the tests from

(foo != bar)

to

!(foo == bar)

because the first one passes when "foo" doesn't exist.  So because
we didn't have control.[x], this test was actually failing for a
while, and no one noticed.

src/tests/keywords/xlat-list

index 94d8613a22076dc199d93c6c10732632de4e6fe6..496a54f819eafce63ea5d6db509defd38ddba1c7 100644 (file)
@@ -3,40 +3,43 @@
        &Tmp-IP-Address-0 = 192.0.2.2
 }
 
-if ("%{control[#]}" != 2) {
+if !(%{control.[#]} == 2) {
        test_fail
 }
 
-if ("%{control[0]}" != 192.0.2.1) {
+if !(%{control.[0]} == 192.0.2.1) {
        test_fail
 }
 
-if ("%{control[1]}" != 192.0.2.2) {
+if !(%{control.[1]} == 192.0.2.2) {
        test_fail
 }
 
-if (("%{control[n]}" != 192.0.2.2)) {
+if !(%{control.[n]} == 192.0.2.2) {
        test_fail
 }
 
-if ("%{control[*]}" != '192.0.2.1192.0.2.2') {
+#
+#  Cast this to a string!
+#
+if !("%{control.[*]}" == '192.0.2.1192.0.2.2') {
        test_fail
 }
 
 # Try calling these xlats in mapping too, they may get optimised to VPTs which is a
 # different code path.
 &request += {
-       &Tmp-IP-Address-1 = "%{control[1]}"
-       &Tmp-IP-Address-1 = "%{control[0]}"
-       &Tmp-String-0   = "%(concat:%{control[*]} ,)"
-       &Tmp-Integer-0 = "%{control[#]}"
+       &Tmp-IP-Address-1 = %{control.[1]}
+       &Tmp-IP-Address-1 = %{control.[0]}
+       &Tmp-String-0   = %(concat:%{control.[*]} ,)
+       &Tmp-Integer-0 = %{control.[#]}
 }
 
-if (&Tmp-String-0 != '192.0.2.1,192.0.2.2') {
+if !(&Tmp-String-0 == '192.0.2.1,192.0.2.2') {
        test_fail
 }
 
-if (&Tmp-Integer-0 != 2) {
+if !(&Tmp-Integer-0 == 2) {
        test_fail
 }