Skip to content

Commit 3e11fad

Browse files
committed
Fix return in ensure hiding test errors
1 parent bf06273 commit 3e11fad

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

test/fiddle/test_func.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def test_strtod
6464
end
6565

6666
def test_qsort1
67+
if RUBY_ENGINE == "jruby"
68+
omit("The untouched sanity check is broken on JRuby: https://github.com/jruby/jruby/issues/8365")
69+
end
70+
6771
closure_class = Class.new(Closure) do
6872
def call(x, y)
6973
Pointer.new(x)[0] <=> Pointer.new(y)[0]
@@ -91,14 +95,15 @@ def call(x, y)
9195
end
9296
ensure
9397
# We can't use ObjectSpace with JRuby.
94-
return if RUBY_ENGINE == "jruby"
95-
# Ensure freeing all closures.
96-
# See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 .
97-
not_freed_closures = []
98-
ObjectSpace.each_object(Fiddle::Closure) do |closure|
99-
not_freed_closures << closure unless closure.freed?
98+
unless RUBY_ENGINE == "jruby"
99+
# Ensure freeing all closures.
100+
# See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 .
101+
not_freed_closures = []
102+
ObjectSpace.each_object(Fiddle::Closure) do |closure|
103+
not_freed_closures << closure unless closure.freed?
104+
end
105+
assert_equal([], not_freed_closures)
100106
end
101-
assert_equal([], not_freed_closures)
102107
end
103108

104109
def test_snprintf

0 commit comments

Comments
 (0)