]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add test for using local attributes in eval
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 8 Nov 2023 01:18:13 +0000 (19:18 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 8 Nov 2023 01:18:13 +0000 (19:18 -0600)
src/tests/keywords/xlat-eval

index 4510588f7c9571406a65df3fd6a37f462520206f..b2989638ce95f47f673e1d584416417d95029694 100644 (file)
@@ -34,10 +34,32 @@ if (!(%eval("\%{Tmp-String-1[%{Tmp-Integer-0[2]}]}") == 'bar')) {
 }
 
 #
-#  Check yielding works
+#  Check yielding works (regression test?)
 #
 if ((time_delta)%reschedule() > 1s) {
        test_fail
 }
 
+#
+#  Verify eval can find local attributes
+#
+group {
+       uint32 idx
+       string stackstr
+
+       &idx := 1
+
+       if (!(%eval("\%{Tmp-String-1[%{idx}]}") == 'bar')) {
+               test_fail
+       }
+
+       &stackstr := { 'foo' }
+
+       &idx := 2
+
+       if (!(%eval("\%{stackstr}") == 'foo')) {
+               test_fail
+       }
+}
+
 success