From: Alan T. DeKok Date: Tue, 22 Nov 2022 13:41:50 +0000 (-0500) Subject: use control.[x] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ef26f72e6dc00fcbc2096f67866a327d39263ef;p=thirdparty%2Ffreeradius-server.git use control.[x] 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. --- diff --git a/src/tests/keywords/xlat-list b/src/tests/keywords/xlat-list index 94d8613a220..496a54f819e 100644 --- a/src/tests/keywords/xlat-list +++ b/src/tests/keywords/xlat-list @@ -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 }