summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-26 10:31:11 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-26 10:31:11 +0000
commit2cd7b7b944dc46f6fa2b177ca00f35394a03cb63 (patch)
tree1e37ceb9d246212016a42865a6cab64dd7340cf1 /test/ruby
parent521590b86ea31e0ebf25cdabf641c9321b7e0f00 (diff)
downloadruby-2cd7b7b944dc46f6fa2b177ca00f35394a03cb63.tar.gz
ruby-2cd7b7b944dc46f6fa2b177ca00f35394a03cb63.tar.xz
ruby-2cd7b7b944dc46f6fa2b177ca00f35394a03cb63.zip
* marshal.c (w_object): dump string encoding in USERDEF.
[ruby-dev:33401] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_marshal.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index e2151e71c..a7f28c0f8 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -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