diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-10 10:39:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-10 10:39:51 +0000 |
commit | 1a7aba1b47311f99a62dba5dfbf5518d6bb3c0cd (patch) | |
tree | d4f1018a302f5bc4ffcec65e4c9ccb06dbc1e9c5 /test/ruby/test_range.rb | |
parent | 04a4fd8957f1e77ffaf6973b680c0697b85857a5 (diff) |
range.c: check if range modifiable
* range.c (range_modify): frozen object cannot be modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_range.rb')
-rw-r--r-- | test/ruby/test_range.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index cfd8b502ed..a70361d6cb 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -11,6 +11,12 @@ class TestRange < Test::Unit::TestCase assert_equal((0...2), Range.new(0, 2, true)) end + def test_frozen_initialize + r = Range.allocate + r.freeze + assert_raise(RuntimeError){r.__send__(:initialize, 1, 2)} + end + def test_range_string # XXX: Is this really the test of Range? assert_equal([], ("a" ... "a").to_a) |