summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorwatson1978 <watson1978@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-25 13:18:44 +0000
committerwatson1978 <watson1978@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-25 13:18:44 +0000
commit7e7d804e38efaff4a9d77cff52e2a6f892205ea0 (patch)
tree0cdd0f2a156a1d0b77ef9c5613c8f0cf6cfff91a /test
parent8607229132adb5c67b0e3f22a6877d6e824c23d9 (diff)
test_range.rb: add tests to improve coverage
This patch will improve the result of line coverage from 91.3% to 95.0%. [Fix GH-1899] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_range.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 58c853fe60..eada19cfb6 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -240,6 +240,18 @@ class TestRange < Test::Unit::TestCase
assert_equal(["a"], a)
a = []
+ (:a .. :z).step(2) {|x| a << x }
+ assert_equal(%i(a c e g i k m o q s u w y), a)
+
+ a = []
+ (:a .. ).step(2) {|x| a << x; break if a.size == 13 }
+ assert_equal(%i(a c e g i k m o q s u w y), a)
+
+ a = []
+ (:a .. :z).step(2**32) {|x| a << x }
+ assert_equal([:a], a)
+
+ a = []
(2**32-1 .. 2**32+1).step(2) {|x| a << x }
assert_equal([4294967295, 4294967297], a)
zero = (2**32).coerce(0).first
@@ -493,6 +505,8 @@ class TestRange < Test::Unit::TestCase
assert_include("a"..."z", "y")
assert_not_include("a"..."z", "z")
assert_not_include("a".."z", "cc")
+ assert_include("a".., "c")
+ assert_not_include("a".., "5")
assert_include(0...10, 5)
assert_include(5..., 10)
assert_not_include(5..., 0)