From 6d336b465a9ff86b933949ebc7a58aeb717bda36 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 27 Feb 2011 09:59:11 +0000 Subject: [PATCH] tests: do not require Fiddle for Ruby 1.9 It's only available when compiled with libffi. --- test/test_posix_mq.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb index 97b6337..fe65f8c 100644 --- a/test/test_posix_mq.rb +++ b/test/test_posix_mq.rb @@ -5,6 +5,10 @@ require 'thread' require 'fcntl' $stderr.sync = $stdout.sync = true require "dl" +begin + require "dl/func" +rescue LoadError +end class Test_POSIX_MQ < Test::Unit::TestCase @@ -102,9 +106,10 @@ class Test_POSIX_MQ < Test::Unit::TestCase libcs = %w(libc.so.6 /usr/lib/libc.sl) libcs.each do |name| libc = DL::Handle.new(name) rescue next - if defined?(Fiddle) + if defined?(DL::Function) alarm = libc["alarm"] - alarm = Fiddle::Function.new(alarm, [DL::TYPE_INT], DL::TYPE_INT) + alarm = DL::CFunc.new(alarm, DL::TYPE_INT, "alarm") + alarm = DL::Function.new(alarm, [DL::TYPE_INT], DL::TYPE_INT) else alarm = libc["alarm", "II"] end -- 2.11.4.GIT