Skip to content

Commit

Permalink
Fix return in ensure hiding test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 9, 2024
1 parent bf06273 commit 3e11fad
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions test/fiddle/test_func.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def test_strtod
end

def test_qsort1
if RUBY_ENGINE == "jruby"
omit("The untouched sanity check is broken on JRuby: https://github.com/jruby/jruby/issues/8365")
end

closure_class = Class.new(Closure) do
def call(x, y)
Pointer.new(x)[0] <=> Pointer.new(y)[0]
Expand Down Expand Up @@ -91,14 +95,15 @@ def call(x, y)
end
ensure
# We can't use ObjectSpace with JRuby.
return if RUBY_ENGINE == "jruby"
# 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?
unless RUBY_ENGINE == "jruby"
# 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
assert_equal([], not_freed_closures)
end

def test_snprintf
Expand Down

0 comments on commit 3e11fad

Please sign in to comment.