From 8ab0220352de7d4acfcbb45a25ef3de54233c8c5 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 11 Oct 2009 18:49:41 +0000 Subject: * marshal.c (has_encoding): added for check the regexp is dumped by 1.8 or 1.9. * marshal.c (r_object0): use has_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_marshal.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 6769539303..b010dcc46f 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -206,11 +206,15 @@ class TestMarshal < Test::Unit::TestCase end def test_regexp + assert_equal(/\\u/, Marshal.load("\004\b/\b\\\\u\000")) + assert_equal(/u/, Marshal.load("\004\b/\a\\u\000")) + assert_equal(/u/, Marshal.load("\004\bI/\a\\u\000\006:\016@encoding\"\vEUC-JP")) + bug2109 = '[ruby-core:25625]' a = "\x82\xa0".force_encoding(Encoding::Windows_31J) b = "\x82\xa2".force_encoding(Encoding::Windows_31J) c = [/#{a}/, /#{b}/] - assert_equal(c, Marshal.load(Marshal.dump(c))) + assert_equal(c, Marshal.load(Marshal.dump(c)), bug2109) end class DumpTest -- cgit v1.2.3