]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more conversion to new function format
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Oct 2023 12:27:19 +0000 (08:27 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Oct 2023 12:27:19 +0000 (08:27 -0400)
src/tests/keywords/expr-double
src/tests/keywords/hex
src/tests/keywords/tolower
src/tests/keywords/toupper
src/tests/keywords/xlat-escape
src/tests/keywords/xlat-string

index e87788cf25a3f84755fc8989d8eb4371bb2c6bb7..ecd17a5e2ae6bb8fb413b96f0cb9b95f3ab6b602 100644 (file)
@@ -1,5 +1,5 @@
 #
 #  We only care if this crashes or not.
 #
-&Filter-Id := "%{eval:1 + 1} %{tolower: 1}"
+&Filter-Id := "%{1 + 1} %tolower(1)"
 success
index 406540985e773e07e26402b24a4702050e9aa157..316ab3ae01f7aa9be0a04e7d5f02b8163405bb5a 100644 (file)
 ok  # break up edit sections
 
 &Tmp-String-1 := {
-       "%{hex:%{Tmp-String-0}}"
-       "%{hex:%{Tmp-Octets-0}}"
-       "%{hex:%{Tmp-IP-Address-0}}"
-       "%{hex:%{Tmp-Integer-0}}"
-       "%{hex:%{Tmp-Cast-Ifid}}"
-       "%{hex:%{Tmp-Cast-IPv6Addr}}"
-       "%{hex:%{Tmp-Cast-IPv6Prefix}}"
-       "%{hex:%{Tmp-Cast-Byte}}"
+       %hex(%{Tmp-String-0})
+       %hex(%{Tmp-Octets-0})
+       %hex(%{Tmp-IP-Address-0})
+       %hex(%{Tmp-Integer-0})
+       %hex(%{Tmp-Cast-Ifid})
+       %hex(%{Tmp-Cast-IPv6Addr})
+       %hex(%{Tmp-Cast-IPv6Prefix})
+       %hex(%{Tmp-Cast-Byte})
 }
 
 # String
@@ -68,10 +68,10 @@ if (!(&Tmp-String-1[7] == '3a')) {
 }
 
 &Tmp-String-1 := {
-       "%{hex:%{Tmp-Cast-Short}}"
-       "%{hex:%{Tmp-Cast-Ether}}"
-       "%{hex:%{Tmp-Cast-Integer64}}"
-       "%{hex:%{Tmp-Cast-IPv4Prefix}}"
+       %hex(%{Tmp-Cast-Short})
+       %hex(%{Tmp-Cast-Ether})
+       %hex(%{Tmp-Cast-Integer64})
+       %hex(%{Tmp-Cast-IPv4Prefix})
 }
 
 # short
index 0cae57d275548b78032e18362970859bcf94f805..d7bb22732fe1ede3efc440909c5e4493d277984a 100644 (file)
@@ -2,13 +2,13 @@
 # PRE: if
 #
 &Tmp-String-0  := "AbCdE"
-&Tmp-String-0  := "%{tolower:%{Tmp-String-0}}"
-&Tmp-String-1  := "%{tolower:AAbbCCdd}"
+&Tmp-String-0  := %tolower(%{Tmp-String-0})
+&Tmp-String-1  := %tolower(AAbbCCdd)
 
 #
 #  Doesn't exist
 #
-&Tmp-String-2  := "%{tolower:%{Tmp-String-9}}"
+&Tmp-String-2  := "%tolower(%{Tmp-String-9})"
 
 
 if (!(&Tmp-String-0 == "abcde")) {
index 5dfbc992f3720903de98084d23fa44d6c55ff0ab..5bc1bea1d17502a137ad5dfe6b0e1e23a0a57263 100644 (file)
@@ -3,9 +3,9 @@
 #
 &Tmp-String-0  := "AbCdE"
 
-&Tmp-String-0  := "%{toupper:%{Tmp-String-0}}"
-&Tmp-String-1  := "%{toupper:AAbbCCdd}"
-&Tmp-String-2  := "%{toupper:%{Tmp-String-9}}"
+&Tmp-String-0  := %toupper(%{Tmp-String-0})
+&Tmp-String-1  := %toupper(AAbbCCdd)
+&Tmp-String-2  := "%toupper(%{Tmp-String-9})"
 
 if (!(&Tmp-String-0 == "ABCDE")) {
        test_fail
index 8a5118104169763f28a455a1ec6c7347ff44458c..8a5a81c0cfdd1e25d842d6e80ad6d5f4638cbd4c 100644 (file)
@@ -1,5 +1,5 @@
 #
-# PRE: update
+# PRE: if
 #
 #
 #  Verify escaping of %
@@ -8,7 +8,7 @@ if !("\%{ FOO}" == '%{ FOO}') {
        test_fail
 }
 
-if !("%{tolower:\%{ FOO}" == '%{ foo') {
+if !(%tolower(\%{FOO}) == '%{foo}') {
        test_fail
 }
 
index a8d861eaec58d78e79a71a008fa601ccf813c5c2..78fd5a0a07b969b942d3590e5b8af2e4870b4034 100644 (file)
 }
 
 &request += {
-       &Tmp-String-0 = "%{string:%{Tmp-Octets-0}}"
-       &Tmp-String-1 = "%{string:%{Tmp-Octets-1}}"
-       &Tmp-String-2 = "%{string:%{Tmp-Octets-2}}"
-       &Tmp-String-3 = "%{string:%{Tmp-Octets-3}}"
+       &Tmp-String-0 = %string(%{Tmp-Octets-0})
+       &Tmp-String-1 = %string(%{Tmp-Octets-1})
+       &Tmp-String-2 = %string(%{Tmp-Octets-2})
+       &Tmp-String-3 = %string(%{Tmp-Octets-3})
 }
 
 if (!(&Tmp-String-0 == "\\\\")) {
@@ -24,15 +24,22 @@ if (!(&Tmp-String-0 == "\\\\")) {
 #
 #  Test interpolation between string expansions and strings
 #
-if (!("%{string:%{Tmp-Octets-4}}%{string:%{Tmp-Octets-5}}" == "test1test2")) {
+if (!("%string(%{Tmp-Octets-4})%string(%{Tmp-Octets-5})" == "test1test2")) {
        test_fail
 }
 
-if (!("test0%{string:%{Tmp-Octets-4}}%{string:%{Tmp-Octets-5}}" == "test0test1test2")) {
+#
+#  We don't need %string(...) either.
+#
+if !("%{(string) &Tmp-Octets-4}%{(string) &Tmp-Octets-5}" == "test1test2") {
+       test_fail
+}
+
+if (!("test0%string(%{Tmp-Octets-4})%string(%{Tmp-Octets-5})" == "test0test1test2")) {
        test_fail
 }
 
-if (!("%{string:%{Tmp-Octets-4}}%{string:%{Tmp-Octets-5}}test3" == "test1test2test3")) {
+if (!("%string(%{Tmp-Octets-4})%string(%{Tmp-Octets-5})test3" == "test1test2test3")) {
        test_fail
 }