ruby-changes:38268
From: nobu <ko1@a...>
Date: Mon, 20 Apr 2015 11:45:10 +0900 (JST)
Subject: [ruby-changes:38268] nobu:r50349 (trunk): test_enum.rb: use assert_warning
nobu 2015-04-20 11:44:59 +0900 (Mon, 20 Apr 2015) New Revision: 50349 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50349 Log: test_enum.rb: use assert_warning * test/ruby/test_enum.rb (test_slice_before): use assert_warning defined in test/lib/envutils.rb. Modified files: trunk/test/ruby/test_enum.rb Index: test/ruby/test_enum.rb =================================================================== --- test/ruby/test_enum.rb (revision 50348) +++ test/ruby/test_enum.rb (revision 50349) @@ -33,20 +33,6 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L33 $VERBOSE = @verbose end - def assert_not_warn - begin - org_stderr = $stderr - v = $VERBOSE - $stderr = StringIO.new(warn = '') - $VERBOSE = true - yield - ensure - $stderr = org_stderr - $VERBOSE = v - end - assert_equal("", warn) - end - def test_grep assert_equal([1, 2, 1, 2], @obj.grep(1..2)) a = [] @@ -513,7 +499,7 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L499 ss = %w[abc defg h ijk l mno pqr st u vw xy z] assert_equal([%w[abc defg h], %w[ijk l], %w[mno], %w[pqr st u vw xy z]], ss.slice_before(/\A...\z/).to_a) - assert_not_warn{ss.slice_before(/\A...\z/).to_a} + assert_warning("") {ss.slice_before(/\A...\z/).to_a} end def test_slice_after0 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/