Skip to content

Commit 7d8d9d5

Browse files
committed
Skip memory tests if an implementation doesn't support ObjectSpace.memsize_of
It seems that JRuby hasn't implemented it.
1 parent bbfd9a0 commit 7d8d9d5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ruby/tests/memory_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ class MemoryTest < Test::Unit::TestCase
1414
# such as arch etc, so there's no point trying to assert the exact return value here.
1515
# We merely assert that we return something other than the default.
1616
def test_objspace_memsize_of_arena
17+
return unless ObjectSpace.respond_to?(:memsize_of)
18+
1719
if $is_64bit
1820
assert_operator 40, :<, ObjectSpace.memsize_of(Google::Protobuf::Internal::Arena.new)
1921
end
2022
end
2123

2224
def test_objspace_memsize_of_message
25+
return unless ObjectSpace.respond_to?(:memsize_of)
26+
2327
if $is_64bit
2428
assert_operator 40, :<, ObjectSpace.memsize_of(FooBar::TestImportedMessage.new)
2529
end
2630
end
2731

2832
def test_objspace_memsize_of_map
33+
return unless ObjectSpace.respond_to?(:memsize_of)
34+
2935
if $is_64bit
3036
assert_operator 40, :<, ObjectSpace.memsize_of(Google::Protobuf::Map.new(:string, :int32))
3137
end

0 commit comments

Comments
 (0)