From: Arran Cudbard-Bell Date: Wed, 29 Jun 2022 16:08:47 +0000 (-0500) Subject: Add basic tests for dollar expansions in conditions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46dc1078f5c5e6e6e69ee98b57a01b0b08257a87;p=thirdparty%2Ffreeradius-server.git Add basic tests for dollar expansions in conditions --- diff --git a/src/tests/modules/test/dollar_expansions.attr b/src/tests/modules/test/dollar_expansions.attr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tests/modules/test/dollar_expansions.unlang b/src/tests/modules/test/dollar_expansions.unlang new file mode 100644 index 00000000000..853b27a72e0 --- /dev/null +++ b/src/tests/modules/test/dollar_expansions.unlang @@ -0,0 +1,16 @@ +# Should be compiled out +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 +} + +# Check against dynamic attributes +if ('${c_term}' != &User-Name) { + test_fail +} +dollar_expansions +test_pass diff --git a/src/tests/modules/test/global.conf b/src/tests/modules/test/global.conf new file mode 100644 index 00000000000..b1cfb765371 --- /dev/null +++ b/src/tests/modules/test/global.conf @@ -0,0 +1,3 @@ +a_term = 'foo' +b_term = 'bar' +c_term = 'bob' diff --git a/src/tests/modules/test/policy.conf b/src/tests/modules/test/policy.conf index 5a675fb4f92..47af41e58ed 100644 --- a/src/tests/modules/test/policy.conf +++ b/src/tests/modules/test/policy.conf @@ -35,3 +35,20 @@ section_names { test_fail } } + +dollar_expansions { + # Should be compiled out + 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 + } + + # Check against dynamic attributes + if ('${c_term}' != &User-Name) { + test_fail + } +}