take-cheeze / mruby-marshal

mruby implementation of cruby marshaling.
12 stars 9 forks source link

Bug. Dumped data collapsed #29

Closed IK-O closed 5 years ago

IK-O commented 5 years ago

When I dumped a aobject which contains several float objects, the data collapsed.

The test code is as follows.

class MarshalTest
  def initialize
    @a = 0.1
    @b = 0.2
    @c = 0.3
  end
end

o = MarshalTest.new
p o

File.open('test.bin', 'wb') do |f|
  Marshal.dump(o, f)
end

File.open('test.bin', 'rb') do |f|
  p Marshal.load(f)
end

The output is as follows.

#<MarshalTest:0x8802a0 @a=0.1, @b=0.2, @c=0.3>
#<MarshalTest:0x8869a0 @a=0.1, @b=0.1, @c=0.3>

MarshalTest.b is collapsed.