diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-09-05 04:54:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-05 17:43:48 +0900 |
commit | 8f752c95d20134bcc0b5394f1cea723a40f1ac8c (patch) | |
tree | 1bc3d801dee68a53a5b033e72261f2f374b0a5cc /test/fiddle/test_func.rb | |
parent | afa33da72b35fd8e98ebd56eb24b6204c35994ce (diff) |
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
https://github.com/ruby/fiddle/commit/e08c4c635e
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4810
Diffstat (limited to 'test/fiddle/test_func.rb')
-rw-r--r-- | test/fiddle/test_func.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test/fiddle/test_func.rb b/test/fiddle/test_func.rb index d3604c79c3..44893017e8 100644 --- a/test/fiddle/test_func.rb +++ b/test/fiddle/test_func.rb @@ -15,7 +15,7 @@ module Fiddle begin f = Function.new(@libm['sinf'], [TYPE_FLOAT], TYPE_FLOAT) rescue Fiddle::DLError - skip "libm may not have sinf()" + omit "libm may not have sinf()" end assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001 end @@ -26,14 +26,13 @@ module Fiddle end def test_string - stress, GC.stress = GC.stress, true - f = Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) - buff = +"000" - str = f.call(buff, "123") - assert_equal("123", buff) - assert_equal("123", str.to_s) - ensure - GC.stress = stress + under_gc_stress do + f = Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) + buff = +"000" + str = f.call(buff, "123") + assert_equal("123", buff) + assert_equal("123", str.to_s) + end end def test_isdigit @@ -76,13 +75,15 @@ module Fiddle bug4929 = '[ruby-core:37395]' buff = "9341" - EnvUtil.under_gc_stress {qsort.call(buff, buff.size, 1, cb)} + under_gc_stress do + qsort.call(buff, buff.size, 1, cb) + end assert_equal("1349", buff, bug4929) end def test_snprintf unless Fiddle.const_defined?("TYPE_VARIADIC") - skip "libffi doesn't support variadic arguments" + omit "libffi doesn't support variadic arguments" end if Fiddle::WINDOWS snprintf_name = "_snprintf" @@ -92,7 +93,7 @@ module Fiddle begin snprintf_pointer = @libc[snprintf_name] rescue Fiddle::DLError - skip "Can't find #{snprintf_name}: #{$!.message}" + omit "Can't find #{snprintf_name}: #{$!.message}" end snprintf = Function.new(snprintf_pointer, [ |