summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-14 02:40:52 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-14 02:40:52 +0000
commit0fd75b46b755dac01f6bc6ccdf40c8abf8e7d23d (patch)
treefed29738bec1c3ee99f6fb758b13c9c73b219c6d
parent27e492bec76b039f69678c42942d113e1f48d811 (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_marshal.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 73be44b264c..d78183192cb 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -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(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(o, o2, "[ruby-dev:40388]")
+ assert_equal(o1, o2)
end
+
end