From 5389c8741c3468f6c9be6e5745ffa7c77d825be5 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Mon, 9 Oct 2023 09:09:33 -0400 Subject: [PATCH] auto-convert functions with fixed string arguments perl -p -i -e "s/%{([a-zA-Z0-9._-]+):([^&%{}=']+)}/%\$1('\$2')/g" $(git grep -lE '%\{[a-z0-9.-]+:' src/tests/keywords/ src/tests/modules) --- src/tests/keywords/md4 | 2 +- src/tests/keywords/md5 | 2 +- src/tests/keywords/rand | 4 ++-- src/tests/keywords/sha1 | 2 +- src/tests/modules/idn/idn.unlang | 12 ++++++------ src/tests/modules/redis/module.conf | 2 +- src/tests/modules/redis_ippool/module.conf | 2 +- src/tests/modules/sql/groups.unlang | 8 ++++---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/tests/keywords/md4 b/src/tests/keywords/md4 index 4f918e04be..fee3d6170c 100644 --- a/src/tests/keywords/md4 +++ b/src/tests/keywords/md4 @@ -11,7 +11,7 @@ &request += { - &Tmp-Octets-1 = "%{md4:This is a string\n}" + &Tmp-Octets-1 = "%md4('This is a string\n')" &Tmp-Octets-2 = "%{md4:%{Tmp-String-0}}" &Tmp-Octets-3 = "%{md4:%{request.Tmp-String-0}}" &Tmp-Octets-4 = "%{md4:%{request.Tmp-Octets-0}}" diff --git a/src/tests/keywords/md5 b/src/tests/keywords/md5 index 38284b842e..4fd20f5aa7 100644 --- a/src/tests/keywords/md5 +++ b/src/tests/keywords/md5 @@ -11,7 +11,7 @@ &request += { - &Tmp-Octets-1 = "%{md5:This is a string\n}" + &Tmp-Octets-1 = "%md5('This is a string\n')" &Tmp-Octets-2 = "%{md5:%{Tmp-String-0}}" &Tmp-Octets-3 = "%{md5:%{request.Tmp-String-0}}" &Tmp-Octets-4 = "%{md5:%{request.Tmp-Octets-0}}" diff --git a/src/tests/keywords/rand b/src/tests/keywords/rand index 5d5441e8cc..94b67e7699 100644 --- a/src/tests/keywords/rand +++ b/src/tests/keywords/rand @@ -1,4 +1,4 @@ -&Tmp-String-0 := "%{rand:-1}" +&Tmp-String-0 := "%rand('-1')" # # Negative limit should have failed assignment @@ -7,7 +7,7 @@ if !(&Tmp-String-0 == "") { test_fail } -&Tmp-String-0 := "%{rand:hello world}" +&Tmp-String-0 := "%rand('hello world')" # # Invalid limit should have failed assignment diff --git a/src/tests/keywords/sha1 b/src/tests/keywords/sha1 index 0630907c34..2dccd062d5 100644 --- a/src/tests/keywords/sha1 +++ b/src/tests/keywords/sha1 @@ -10,7 +10,7 @@ } &request += { - &Tmp-Octets-2 = "%{sha1:This is a string\n}" + &Tmp-Octets-2 = "%sha1('This is a string\n')" &Tmp-Octets-3 = "%{sha1:%{Tmp-String-0}}" &Tmp-Octets-4 = "%{sha1:%{request.Tmp-String-0}}" &Tmp-Octets-5 = "%{sha1:%{request.Tmp-Octets-9}}" diff --git a/src/tests/modules/idn/idn.unlang b/src/tests/modules/idn/idn.unlang index 8ad0697798..1fe85afe9b 100644 --- a/src/tests/modules/idn/idn.unlang +++ b/src/tests/modules/idn/idn.unlang @@ -3,10 +3,10 @@ # &Tmp-String-0 := "%idn('example.com')" -&Tmp-String-1 := "%{idn:èxâmpłé.com}" -&Tmp-String-2 := "%{idn:пример.com}" -&Tmp-String-3 := "%{idn:παράδειγμα.com}" -&Tmp-String-4 := "%{idn:ตัวอย่าง.com}" +&Tmp-String-1 := "%idn('èxâmpłé.com')" +&Tmp-String-2 := "%idn('пример.com')" +&Tmp-String-3 := "%idn('παράδειγμα.com')" +&Tmp-String-4 := "%idn('ตัวอย่าง.com')" if (&Tmp-String-0 != "example.com") { test_fail @@ -28,7 +28,7 @@ if (&Tmp-String-4 != "xn--72c1a1bt4awk9o.com") { test_fail } -&Tmp-String-0 := "%{idn:invalid_example.com}" +&Tmp-String-0 := "%idn('invalid_example.com')" if (&Module-Failure-Message != "Non-digit/letter/hyphen in input") { test_fail @@ -40,7 +40,7 @@ if (&Module-Failure-Message == "") { &request -= &Module-Failure-Message[*] -&Tmp-String-0 := "%{idn:a.véry.löng.ņàme.whîch.when.expânded.exceedş.ţhe.dns.stanđard.fór.string.łength.of.twø.hündred.ând.fifty.threé.charáctèrs.and.therefore.is.invalid.for.idn.conversion}" +&Tmp-String-0 := "%idn('a.véry.löng.ņàme.whîch.when.expânded.exceedş.ţhe.dns.stanđard.fór.string.łength.of.twø.hündred.ând.fifty.threé.charáctèrs.and.therefore.is.invalid.for.idn.conversion')" if (&Module-Failure-Message != "Conversion was truncated") { test_fail diff --git a/src/tests/modules/redis/module.conf b/src/tests/modules/redis/module.conf index fe644b5ded..9d303b73b2 100644 --- a/src/tests/modules/redis/module.conf +++ b/src/tests/modules/redis/module.conf @@ -4,7 +4,7 @@ # # Configuration file for the "redis" module. This module does nothing -# Other than provide connections to a redis database, and a %{redis: ...} +# Other than provide connections to a redis database, and a %redis(' ...') # expansion. # redis { diff --git a/src/tests/modules/redis_ippool/module.conf b/src/tests/modules/redis_ippool/module.conf index 38f9951ff2..88a82699e1 100644 --- a/src/tests/modules/redis_ippool/module.conf +++ b/src/tests/modules/redis_ippool/module.conf @@ -4,7 +4,7 @@ # # Configuration file for the "redis" module. This module does nothing -# Other than provide connections to a redis database, and a %{redis: ...} +# Other than provide connections to a redis database, and a %redis(' ...') # expansion. # redis_ippool { diff --git a/src/tests/modules/sql/groups.unlang b/src/tests/modules/sql/groups.unlang index 7fb5013934..c5edca64bd 100644 --- a/src/tests/modules/sql/groups.unlang +++ b/src/tests/modules/sql/groups.unlang @@ -54,20 +54,20 @@ else { # # Test paircmp group comparisons # -if (%{sql.group:groups_group_a} != false) { +if (%sql.group('groups_group_a') != false) { test_fail } -if (%{sql.group:groups_group_b} != true) { +if (%sql.group('groups_group_b') != true) { test_fail } -if (%{sql.group:groups_group_c} != true) { +if (%sql.group('groups_group_c') != true) { test_fail } # Non-existent group -if (%{sql.group:groups_group_d} != false) { +if (%sql.group('groups_group_d') != false) { test_fail } -- 2.47.2