diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-22 02:58:37 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-22 02:58:37 +0000 |
commit | c19ecf05b4c728951e1a1e223a40ae6883a4f8e0 (patch) | |
tree | a9c8e11f3540c6852cd9ac1b1327fef67d104a24 /test/ruby/test_range.rb | |
parent | 3afb77330fc06d112a5243e5486f043c1339a90b (diff) |
range.c: Range#to_a now raises RangeError if it is endless
Fixes [Bug #14845]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63714 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 c98b130456..3cbd155d84 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -794,4 +794,10 @@ class TestRange < Test::Unit::TestCase end (a.."c").each {|x, &b| assert_nil(b)} end + + def test_to_a + assert_equal([1,2,3,4,5], (1..5).to_a) + assert_equal([1,2,3,4], (1...5).to_a) + assert_raise(RangeError) { (1..).to_a } + end end |