Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/fiddle/test_func.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ def call(x, y)
qsort = Function.new(@libc['qsort'],
[TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP],
TYPE_VOID)
buff = "9341"
untouched = "9341"
buff = +"9341"
qsort.call(buff, buff.size, 1, callback)
assert_equal("1349", buff)

bug4929 = '[ruby-core:37395]'
buff = "9341"
buff = +"9341"
under_gc_stress do
qsort.call(buff, buff.size, 1, callback)
end
assert_equal("1349", buff, bug4929)

# Ensure the test didn't mutate String literals
assert_equal("93" + "41", untouched)
Copy link
Copy Markdown
Member

@eregon eregon Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the added + above this was failing, which meant Fiddle tests were permanently changing the meaning of all "9341" frozen string literals.

Interestingly this sanity check actually fails on JRuby, I'll file an issue there: jruby/jruby#8365

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JRuby issue has been fixed on master and will be in JRuby 9.4.9.0.

We won't be updating 9.4 to use the fiddle gem in any case, but the test could be un-omitted now.

end
ensure
# We can't use ObjectSpace with JRuby.
Expand Down