Merge fiddle-1.1.1

This commit is contained in:
Hiroshi SHIBATA 2022-12-09 13:43:01 +09:00
parent 4e31fea77d
commit 286812bcf3
Notes: git 2022-12-09 07:36:47 +00:00
3 changed files with 32 additions and 1 deletions

View File

@ -151,7 +151,7 @@ if libffi_version
libffi_version = libffi_version.gsub(/-rc\d+/, '')
libffi_version = (libffi_version.split('.').map(&:to_i) + [0,0])[0,3]
$defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % libffi_version }})
puts "libffi_version: #{libffi_version.join('.')}"
warn "libffi_version: #{libffi_version.join('.')}"
end
case

View File

@ -650,6 +650,30 @@ Init_fiddle(void)
rb_define_module_function(mFiddle, "realloc", rb_fiddle_realloc, 2);
rb_define_module_function(mFiddle, "free", rb_fiddle_free, 1);
/* Document-const: Qtrue
*
* The value of Qtrue
*/
rb_define_const(mFiddle, "Qtrue", INT2NUM(Qtrue));
/* Document-const: Qfalse
*
* The value of Qfalse
*/
rb_define_const(mFiddle, "Qfalse", INT2NUM(Qfalse));
/* Document-const: Qnil
*
* The value of Qnil
*/
rb_define_const(mFiddle, "Qnil", INT2NUM(Qnil));
/* Document-const: Qundef
*
* The value of Qundef
*/
rb_define_const(mFiddle, "Qundef", INT2NUM(Qundef));
Init_fiddle_function();
Init_fiddle_closure();
Init_fiddle_handle();

View File

@ -5,6 +5,13 @@ rescue LoadError
end
class TestFiddle < Fiddle::TestCase
def test_nil_true_etc
assert_equal Fiddle::Qtrue, Fiddle.dlwrap(true)
assert_equal Fiddle::Qfalse, Fiddle.dlwrap(false)
assert_equal Fiddle::Qnil, Fiddle.dlwrap(nil)
assert Fiddle::Qundef
end
def test_windows_constant
require 'rbconfig'
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/