summaryrefslogtreecommitdiff
path: root/test/fiddle/test_function.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/fiddle/test_function.rb')
-rw-r--r--test/fiddle/test_function.rb28
1 files changed, 8 insertions, 20 deletions
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb
index 847df3793a..8ac4f60aa3 100644
--- a/test/fiddle/test_function.rb
+++ b/test/fiddle/test_function.rb
@@ -15,16 +15,6 @@ module Fiddle
end
end
- def teardown
- # Ensure freeing all closures.
- # See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 .
- not_freed_closures = []
- ObjectSpace.each_object(Fiddle::Closure) do |closure|
- not_freed_closures << closure unless closure.freed?
- end
- assert_equal([], not_freed_closures)
- end
-
def test_default_abi
func = Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE)
assert_equal Function::DEFAULT, func.abi
@@ -85,20 +75,18 @@ module Fiddle
end
def test_argument_count
- closure_class = Class.new(Closure) do
+ closure = Class.new(Closure) {
def call one
10 + one
end
- end
- closure_class.create(TYPE_INT, [TYPE_INT]) do |closure|
- func = Function.new(closure, [TYPE_INT], TYPE_INT)
+ }.new(TYPE_INT, [TYPE_INT])
+ func = Function.new(closure, [TYPE_INT], TYPE_INT)
- assert_raise(ArgumentError) do
- func.call(1,2,3)
- end
- assert_raise(ArgumentError) do
- func.call
- end
+ assert_raise(ArgumentError) do
+ func.call(1,2,3)
+ end
+ assert_raise(ArgumentError) do
+ func.call
end
end