mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* marshal.c (w_object): dump string encoding in USERDEF.
[ruby-dev:33401] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
51ea2cf4e4
commit
26b86d8a72
3 changed files with 17 additions and 1 deletions
|
@ -57,6 +57,7 @@ class TestMarshal < Test::Unit::TestCase
|
|||
def initialize(str)
|
||||
@str = str
|
||||
end
|
||||
attr_reader :str
|
||||
def _dump(limit)
|
||||
@str
|
||||
end
|
||||
|
@ -73,4 +74,14 @@ class TestMarshal < Test::Unit::TestCase
|
|||
}
|
||||
assert_equal("marshal data too short", e.message)
|
||||
end
|
||||
|
||||
|
||||
def test_userdef_encoding
|
||||
s1 = "\xa4\xa4".force_encoding("euc-jp")
|
||||
o1 = C.new(s1)
|
||||
m = Marshal.dump(o1)
|
||||
o2 = Marshal.load(m)
|
||||
s2 = o2.str
|
||||
assert_equal(s1, s2)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue