diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2021-02-26 10:06:30 -0800 |
---|---|---|
committer | Aaron Patterson <tenderlove@ruby-lang.org> | 2021-02-26 10:06:56 -0800 |
commit | d45466dc5b9b45d5b78d161fc86265e6e19d6e1e (patch) | |
tree | e27eb3ec290f92733c27078805f2a44fe723c21a /test | |
parent | 3d8e373a588bca976f7f1a8172b5b1b27d78f60f (diff) |
Oops! Add another test and fix to_proc implementation
Diffstat (limited to 'test')
-rw-r--r-- | test/fiddle/test_function.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb index 5dc456b82b..a5284e093a 100644 --- a/test/fiddle/test_function.rb +++ b/test/fiddle/test_function.rb @@ -115,6 +115,17 @@ module Fiddle assert_equal("123", str.to_s) end + def test_function_as_method + f = Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) + klass = Class.new do + define_singleton_method(:strcpy, &f) + end + buff = +"000" + str = klass.strcpy(buff, "123") + assert_equal("123", buff) + assert_equal("123", str.to_s) + end + def test_nogvl_poll # XXX hack to quiet down CI errors on EINTR from r64353 # [ruby-core:88360] [Misc #14937] |