mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Skip fiddle assertions if fiddle is not available
This commit is contained in:
parent
158e4cc4ec
commit
e0c0e06154
Notes:
git
2025-02-25 06:37:02 +00:00
1 changed files with 8 additions and 1 deletions
|
@ -3,7 +3,10 @@
|
|||
require_relative "helper"
|
||||
require "rubygems/ext"
|
||||
require "open3"
|
||||
require "fiddle"
|
||||
begin
|
||||
require "fiddle"
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
class TestGemExtCargoBuilder < Gem::TestCase
|
||||
def setup
|
||||
|
@ -150,6 +153,8 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|||
end
|
||||
|
||||
def assert_ffi_handle(bundle, name)
|
||||
return unless defined?(Fiddle)
|
||||
|
||||
dylib_handle = Fiddle.dlopen bundle
|
||||
assert_nothing_raised { dylib_handle[name] }
|
||||
ensure
|
||||
|
@ -157,6 +162,8 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|||
end
|
||||
|
||||
def refute_ffi_handle(bundle, name)
|
||||
return unless defined?(Fiddle)
|
||||
|
||||
dylib_handle = Fiddle.dlopen bundle
|
||||
assert_raise { dylib_handle[name] }
|
||||
ensure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue