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 | 54bc0a446dd83c475c7ba540bccc1d9b3ad1e39a (patch) | |
tree | 97859b6c38e2fdc08e8483ad0a46096c783c43be /test/ruby | |
parent | e41ebc50dc27f5b91690295e0db8eaf45da42630 (diff) | |
download | ruby-54bc0a446dd83c475c7ba540bccc1d9b3ad1e39a.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/ruby')
-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 |