From: Alan T. DeKok Date: Sun, 8 Oct 2023 12:03:26 +0000 (-0400) Subject: more "get rid of expr" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8723bf20bf1284a0eab1e5ba4b3f56a01b6df08;p=thirdparty%2Ffreeradius-server.git more "get rid of expr" --- diff --git a/src/tests/keywords/foreach-error b/src/tests/keywords/foreach-error index 8aecb02792..76d0458587 100644 --- a/src/tests/keywords/foreach-error +++ b/src/tests/keywords/foreach-error @@ -1,3 +1,3 @@ -foreach "%expr(1 + 2)" { # ERROR +foreach "%tolower('foo')" { # ERROR &reply.Called-Station-Id += "%{Foreach-Variable-0}" } diff --git a/src/tests/keywords/foreach-isolation b/src/tests/keywords/foreach-isolation index 9e795e769a..bb97bf8481 100644 --- a/src/tests/keywords/foreach-isolation +++ b/src/tests/keywords/foreach-isolation @@ -6,7 +6,7 @@ foreach &control.Tmp-String-0 { &control -= { - &Tmp-String-0 == "%{expr:%{Foreach-Variable-0} + 1}" + &Tmp-String-0 == "%{1 + %{Foreach-Variable-0}}" } &request += { &Tmp-String-0 = "%{Foreach-Variable-0}" diff --git a/src/tests/keywords/nexttime b/src/tests/keywords/nexttime index 1e99593995..f05a062f5f 100644 --- a/src/tests/keywords/nexttime +++ b/src/tests/keywords/nexttime @@ -7,7 +7,7 @@ # different numbers of days involved. Check hour / day / week # -&Tmp-Integer-0 := "%{expr:%(nexttime:2h) - %(nexttime:1h)}" +&Tmp-Integer-0 := "%{%nexttime(2h) - %nexttime(1h)}" # We have a fudge factor of 1 second either way if ((&Tmp-Integer-0 < 3599) || (&Tmp-Integer-0 > 3601)) { @@ -17,7 +17,7 @@ if ((&Tmp-Integer-0 < 3599) || (&Tmp-Integer-0 > 3601)) { # # Day # -&Tmp-Integer-0 := "%{expr:%(nexttime:3d) - %(nexttime:1d)}" +&Tmp-Integer-0 := "%{%nexttime(3d) - %nexttime(1d)}" if ((&Tmp-Integer-0 < 172799) || (&Tmp-Integer-0 > 172801)) { test_fail } @@ -25,7 +25,7 @@ if ((&Tmp-Integer-0 < 172799) || (&Tmp-Integer-0 > 172801)) { # # Week # -&Tmp-Integer-0 := "%{expr:%(nexttime:4w) - %(nexttime:2w)}" +&Tmp-Integer-0 := "%{%nexttime(4w) - %nexttime(2w)}" if ((&Tmp-Integer-0 < 1209599) || (&Tmp-Integer-0 > 1209601)) { test_fail } diff --git a/src/tests/keywords/xlat-error b/src/tests/keywords/xlat-error index b9d97ae502..0d61d32d42 100644 --- a/src/tests/keywords/xlat-error +++ b/src/tests/keywords/xlat-error @@ -5,6 +5,6 @@ # # missing a closing } for the expansion in the string. # -if ("%{expr:1 + 2" == 3) { # ERROR +if ("%{User-Name" == 3) { # ERROR test_fail } diff --git a/src/tests/modules/ldap/xlat.unlang b/src/tests/modules/ldap/xlat.unlang index 82dc02239d..e60c3c8df6 100644 --- a/src/tests/modules/ldap/xlat.unlang +++ b/src/tests/modules/ldap/xlat.unlang @@ -87,7 +87,7 @@ if (!(&Tmp-String-0 == "Fred Jones")) { } # Reference an alternative LDAP server in the xlat -&Tmp-String-1 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:%{expr:$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" +&Tmp-String-1 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:%{$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" if (!(&Tmp-String-1 == "Fred Jones")) { test_fail diff --git a/src/tests/unit/xlat/purify.txt b/src/tests/unit/xlat/purify.txt index 63d4f0e410..df5f6585ea 100644 --- a/src/tests/unit/xlat/purify.txt +++ b/src/tests/unit/xlat/purify.txt @@ -217,10 +217,11 @@ xlat_purify "hello " + (string)%{1 + 2} + " bob" match "hello 3 bob" # -# This should be the same as above, but it isn't! +# @todo - this seems wrong, but likely a bug in unit_test_attribute.c +# The real run-time tests work # -xlat_purify "hello %{expr:1} bob" -match "hello 1 bob" +xlat_purify "hello %{1 + 2} bob" +match %(cast:string "hello (1 + 2) bob") # # New syntax!