]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check dollar expansions work for non-strings
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 29 Jun 2022 16:21:00 +0000 (11:21 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 29 Jun 2022 16:21:00 +0000 (11:21 -0500)
src/tests/modules/test/dollar_expansions.unlang
src/tests/modules/test/global.conf
src/tests/modules/test/policy.conf

index 853b27a72e09c5ab83922fa18a7a890e124c6fde..048910208dbc21f05c245ff38d51798bfd4d22d2 100644 (file)
@@ -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
index b1cfb765371bc4474c1a9ee9acf3624198811246..a4b01866130b2d3d3bdc361fd4507473e8dbc0fd 100644 (file)
@@ -1,3 +1,4 @@
 a_term = 'foo'
 b_term = 'bar'
 c_term = 'bob'
+d_term = yes
index 47af41e58ed489dd9811f033d20de63f32645a52..b6886acf13665bb69fd23479a7f79e1b1b1dc29a 100644 (file)
@@ -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