summaryrefslogtreecommitdiff
path: root/test/date
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-13 04:29:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-13 04:29:31 +0000
commit0fa71d44d505daf60bf8d4539ef4548207ba4002 (patch)
treecd82f2983b988e552ac596546de846fcda8a4448 /test/date
parent8655d0735fe08a38b290d7b83c2f9c9901800544 (diff)
date_core.c: respect COMPLEX_DAT bit
* ext/date/date_core.c (d_lite_marshal_load): respect COMPLEX_DAT bit in the pre-allocated structure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/date')
-rw-r--r--test/date/test_date_marshal.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/date/test_date_marshal.rb b/test/date/test_date_marshal.rb
index 24622bd4b9..c7ce737aac 100644
--- a/test/date/test_date_marshal.rb
+++ b/test/date/test_date_marshal.rb
@@ -41,4 +41,12 @@ class TestDateMarshal < Test::Unit::TestCase
assert_raise(expected_error){d.marshal_load(a)}
end
+ def test_memsize
+ require 'objspace'
+ t = DateTime.new(2018, 11, 13)
+ size = ObjectSpace.memsize_of(t)
+ t2 = Marshal.load(Marshal.dump(t))
+ assert_equal(t, t2)
+ assert_equal(size, ObjectSpace.memsize_of(t2), "not reallocated but memsize changed")
+ end
end