mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27e492bec7
commit
0fd75b46b7
1 changed files with 19 additions and 4 deletions
|
@ -429,10 +429,25 @@ class TestMarshal < Test::Unit::TestCase
|
|||
assert_equal(STDIN, o.stdin)
|
||||
end
|
||||
|
||||
def test_marshal_encoding
|
||||
o = ["foo".force_encoding("EUC-JP")] + [ "bar" ] * 2
|
||||
m = Marshal.dump(o)
|
||||
def test_marshal_string_encoding
|
||||
o1 = ["foo".force_encoding("EUC-JP")] + [ "bar" ] * 2
|
||||
m = Marshal.dump(o1)
|
||||
o2 = Marshal.load(m)
|
||||
assert_equal(o, o2, "[ruby-dev:40388]")
|
||||
assert_equal(o1, o2, "[ruby-dev:40388]")
|
||||
end
|
||||
|
||||
def test_marshal_regexp_encoding
|
||||
o1 = [Regexp.new("r1".force_encoding("EUC-JP"))] + ["r2"] * 2
|
||||
m = Marshal.dump(o1)
|
||||
o2 = Marshal.load(m)
|
||||
assert_equal(o1, o2, "[ruby-dev:40416]")
|
||||
end
|
||||
|
||||
def test_marshal_encoding_encoding
|
||||
o1 = [Encoding.find("EUC-JP")] + ["r2"] * 2
|
||||
m = Marshal.dump(o1)
|
||||
o2 = Marshal.load(m)
|
||||
assert_equal(o1, o2)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue