Move out from quarantine a Marshal.dump spec for Float (#12692)

* Move out from quarantine a Marshal.dump spec for Float

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
This commit is contained in:
Andrii Konchyn 2025-02-03 15:24:16 +02:00 committed by GitHub
parent 1683dadb19
commit 7317f96727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2025-02-03 13:24:36 +00:00
Merged-By: eregon <eregontp@gmail.com>

View File

@ -286,9 +286,20 @@ describe "Marshal.dump" do
].should be_computed_by(:dump)
end
quarantine! do # fails on i686 with 'Expected "\x04\b[\af\x060f\x060" == "\x04\b[\af\x060@\x06" to be truthy but was false'
it "uses object links for objects repeatedly dumped" do
Marshal.dump([0.0, 0.0]).should == "\x04\b[\af\x060@\x06" # @\x06 is a link to the float value
it "may or may not use object links for objects repeatedly dumped" do
# it's an MRI implementation detail - on x86 architecture object links
# aren't used for Float values but on amd64 - object links are used
dump = Marshal.dump([0.0, 0.0])
["\x04\b[\af\x060@\x06", "\x04\b[\af\x060f\x060"].should.include?(dump)
# if object links aren't used - entries in the objects table are still
# occupied by Float values
if dump == "\x04\b[\af\x060f\x060"
s = "string"
# an index of "string" ("@\b") in the object table equals 3 (`"\b".ord - 5`),
# so `0.0, 0,0` elements occupied indices 1 and 2
Marshal.dump([0.0, 0.0, s, s]).should == "\x04\b[\tf\x060f\x060\"\vstring@\b"
end
end
end