]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add test using float value in mRuby
authorNick Porter <nick@portercomputing.co.uk>
Tue, 5 Aug 2025 11:30:19 +0000 (12:30 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 5 Aug 2025 11:30:19 +0000 (12:30 +0100)
src/tests/modules/mruby/attrs.unlang
src/tests/modules/mruby/test.rb

index 191eac2db497ccb8f391bb71ecfb938e40bdcf0c..a916526dd39fe01b2343aba61c2a34da09331752 100644 (file)
@@ -24,6 +24,14 @@ if (User-Name != 'john') {
        test_fail
 }
 
+mruby.set_float
+if (!ok) {
+       test_fail
+}
+if (NAS-Port != 12) {
+       test_fail
+}
+
 mruby.set_nested
 if (!updated) {
        test_fail
index 49af52fb7556683db176a4dada025bcacb72ca08..c89cf7ade2e00b4ac9b03db20fbad881a370ae72 100644 (file)
@@ -31,6 +31,12 @@ module FreeRADIUS
     return RLM_MODULE_OK
   end
 
+  # Check casting from a float
+  def self.set_float(p)
+    p.request.nas_port.set(12.0)
+    return RLM_MODULE_OK
+  end
+
   # Check setting nested pairs
   def self.set_nested(p)
     p.control.vendor_specific.cisco.avpair.set('very=special')