aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-11 11:52:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-11 11:52:03 +0000
commitd3f8c0f3e344ad3b680a3053f8cf0c60127b731e (patch)
tree97859b6c38e2fdc08e8483ad0a46096c783c43be /test
parent0cfc1bddf4e06e5627816c2bd89e5adedf868895 (diff)
downloadruby-d3f8c0f3e344ad3b680a3053f8cf0c60127b731e.tar.gz
range.c: check loading
* range.c (range_loader): check loading values if the data came from an initialized range object. [ruby-core:78067] [Bug #12915] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_range.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index a70361d6cb..1ce3f0663a 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -110,6 +110,16 @@ class TestRange < Test::Unit::TestCase
assert_nothing_raised { r.instance_eval { initialize 5, 6} }
end
+ def test_marshal
+ r = 1..2
+ assert_equal(r, Marshal.load(Marshal.dump(r)))
+ r = 1...2
+ assert_equal(r, Marshal.load(Marshal.dump(r)))
+ s = Marshal.dump(r)
+ s.sub!(/endi./n, 'end0')
+ assert_raise(ArgumentError) {Marshal.load(s)}
+ end
+
def test_bad_value
assert_raise(ArgumentError) { (1 .. :a) }
end