From 7e7d804e38efaff4a9d77cff52e2a6f892205ea0 Mon Sep 17 00:00:00 2001 From: watson1978 Date: Mon, 25 Jun 2018 13:18:44 +0000 Subject: 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 --- test/ruby/test_range.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') 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 @@ -239,6 +239,18 @@ class TestRange < Test::Unit::TestCase ("a" .. "z").step(2**32) {|x| a << x } 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) @@ -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) -- cgit v1.2.3