mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
[ruby/fiddle] Accept Symbol as Function name again
GitHub: fix https://github.com/ruby/fiddle/pull/159
It's used by FFI test. So Symbol may be used by other use cases.
https://github.com/ruby/fiddle/pull/139 introduced the "Function name is String" limitation. This
commit removed the limitation.
Reported by Mamoru TASAKA. Thanks!!!
cea30fe5f9
This commit is contained in:
parent
5eaa4c76c6
commit
a23c6db5c5
2 changed files with 27 additions and 2 deletions
|
@ -37,6 +37,11 @@ module Fiddle
|
|||
assert_equal 'sin', func.name
|
||||
end
|
||||
|
||||
def test_name_symbol
|
||||
func = Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE, name: :sin)
|
||||
assert_equal :sin, func.name
|
||||
end
|
||||
|
||||
def test_need_gvl?
|
||||
if RUBY_ENGINE == "jruby"
|
||||
omit("rb_str_dup() doesn't exist in JRuby")
|
||||
|
@ -261,7 +266,25 @@ module Fiddle
|
|||
|
||||
def test_ractor_shareable
|
||||
omit("Need Ractor") unless defined?(Ractor)
|
||||
assert_ractor_shareable(Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE))
|
||||
assert_ractor_shareable(Function.new(@libm["sin"],
|
||||
[TYPE_DOUBLE],
|
||||
TYPE_DOUBLE))
|
||||
end
|
||||
|
||||
def test_ractor_shareable_name
|
||||
omit("Need Ractor") unless defined?(Ractor)
|
||||
assert_ractor_shareable(Function.new(@libm["sin"],
|
||||
[TYPE_DOUBLE],
|
||||
TYPE_DOUBLE,
|
||||
name: "sin"))
|
||||
end
|
||||
|
||||
def test_ractor_shareable_name_symbol
|
||||
omit("Need Ractor") unless defined?(Ractor)
|
||||
assert_ractor_shareable(Function.new(@libm["sin"],
|
||||
[TYPE_DOUBLE],
|
||||
TYPE_DOUBLE,
|
||||
name: :sin))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue