mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54: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_relative "helper"
|
||||||
require "rubygems/ext"
|
require "rubygems/ext"
|
||||||
require "open3"
|
require "open3"
|
||||||
|
begin
|
||||||
require "fiddle"
|
require "fiddle"
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
class TestGemExtCargoBuilder < Gem::TestCase
|
class TestGemExtCargoBuilder < Gem::TestCase
|
||||||
def setup
|
def setup
|
||||||
|
@ -150,6 +153,8 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_ffi_handle(bundle, name)
|
def assert_ffi_handle(bundle, name)
|
||||||
|
return unless defined?(Fiddle)
|
||||||
|
|
||||||
dylib_handle = Fiddle.dlopen bundle
|
dylib_handle = Fiddle.dlopen bundle
|
||||||
assert_nothing_raised { dylib_handle[name] }
|
assert_nothing_raised { dylib_handle[name] }
|
||||||
ensure
|
ensure
|
||||||
|
@ -157,6 +162,8 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def refute_ffi_handle(bundle, name)
|
def refute_ffi_handle(bundle, name)
|
||||||
|
return unless defined?(Fiddle)
|
||||||
|
|
||||||
dylib_handle = Fiddle.dlopen bundle
|
dylib_handle = Fiddle.dlopen bundle
|
||||||
assert_raise { dylib_handle[name] }
|
assert_raise { dylib_handle[name] }
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue