diff options
| author | Andrii Konchyn <andry.konchin@gmail.com> | 2025-02-03 15:24:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 13:24:16 +0000 |
| commit | 7317f96727725ca37ddb06011918deb841de371c (patch) | |
| tree | 85001eed537e89c47f30560a215c149577af93ec | |
| parent | 1683dadb19876f0a64589bdbbcf6fff8143f78ff (diff) | |
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>
Notes
Notes:
Merged-By: eregon <eregontp@gmail.com>
| -rw-r--r-- | spec/ruby/core/marshal/dump_spec.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/ruby/core/marshal/dump_spec.rb b/spec/ruby/core/marshal/dump_spec.rb index 1b05263e7d..cc5337b50e 100644 --- a/spec/ruby/core/marshal/dump_spec.rb +++ b/spec/ruby/core/marshal/dump_spec.rb @@ -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 |
