From: Arran Cudbard-Bell Date: Wed, 29 Jun 2022 16:21:00 +0000 (-0500) Subject: Check dollar expansions work for non-strings X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bda30002fa2161edba2c135341bc125bdba5c5cb;p=thirdparty%2Ffreeradius-server.git Check dollar expansions work for non-strings --- diff --git a/src/tests/modules/test/dollar_expansions.unlang b/src/tests/modules/test/dollar_expansions.unlang index 853b27a72e0..048910208db 100644 --- a/src/tests/modules/test/dollar_expansions.unlang +++ b/src/tests/modules/test/dollar_expansions.unlang @@ -1,16 +1,32 @@ +update { + &Tmp-Bool-0 := yes +} # Should be compiled out if ('${a_term}' != '${a_term}') { - test_fail + test_fail +} + +if ("${a_term}" != "${a_term}") { + test_fail +} + +if (&Tmp-Bool-0 != ${d_term}) { + test_fail +} + +if ('${a_term}' !~ /${a_term}/) { + test_fail } # Check it's not just expanded to a zero length string if ('${a_term}' == '${b_term}') { - test_fail + test_fail } # Check against dynamic attributes if ('${c_term}' != &User-Name) { - test_fail + test_fail } + dollar_expansions test_pass diff --git a/src/tests/modules/test/global.conf b/src/tests/modules/test/global.conf index b1cfb765371..a4b01866130 100644 --- a/src/tests/modules/test/global.conf +++ b/src/tests/modules/test/global.conf @@ -1,3 +1,4 @@ a_term = 'foo' b_term = 'bar' c_term = 'bob' +d_term = yes diff --git a/src/tests/modules/test/policy.conf b/src/tests/modules/test/policy.conf index 47af41e58ed..b6886acf136 100644 --- a/src/tests/modules/test/policy.conf +++ b/src/tests/modules/test/policy.conf @@ -37,11 +37,26 @@ section_names { } dollar_expansions { + update { + &Tmp-Bool-0 := yes + } # Should be compiled out if ('${a_term}' != '${a_term}') { test_fail } + if ("${a_term}" != "${a_term}") { + test_fail + } + + if (&Tmp-Bool-0 != ${d_term}) { + test_fail + } + + if ('${a_term}' !~ /${a_term}/) { + test_fail + } + # Check it's not just expanded to a zero length string if ('${a_term}' == '${b_term}') { test_fail