ruby-changes:51540
From: watson1978 <ko1@a...>
Date: Mon, 25 Jun 2018 22:18:53 +0900 (JST)
Subject: [ruby-changes:51540] watson1978:r63750 (trunk): test_range.rb: add tests to improve coverage
watson1978 2018-06-25 22:18:44 +0900 (Mon, 25 Jun 2018) New Revision: 63750 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63750 Log: 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] Modified files: trunk/test/ruby/test_range.rb Index: test/ruby/test_range.rb =================================================================== --- test/ruby/test_range.rb (revision 63749) +++ test/ruby/test_range.rb (revision 63750) @@ -240,6 +240,18 @@ class TestRange < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L240 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L505 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/