diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 11:52:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 11:52:03 +0000 |
commit | d3f8c0f3e344ad3b680a3053f8cf0c60127b731e (patch) | |
tree | 97859b6c38e2fdc08e8483ad0a46096c783c43be /test | |
parent | 0cfc1bddf4e06e5627816c2bd89e5adedf868895 (diff) | |
download | ruby-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.rb | 10 |
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 |