From 2dc5e62545eb18feb85b1fa321f19904704cc76f Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 29 Nov 2012 22:02:36 +0000 Subject: Imported minitest 4.3.2 (r8027) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/minitest/test_minitest_unit.rb | 43 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'test/minitest') diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb index a03296d7b6..d3f7d4c1c3 100644 --- a/test/minitest/test_minitest_unit.rb +++ b/test/minitest/test_minitest_unit.rb @@ -684,6 +684,15 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc._assertions end + def non_verbose + orig_verbose = $VERBOSE + $VERBOSE = false + + yield + ensure + $VERBOSE = orig_verbose + end + def test_assert @assertion_count = 2 @@ -1314,36 +1323,30 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase def test_capture_io @assertion_count = 0 - orig_verbose = $VERBOSE - $VERBOSE = false + non_verbose do + out, err = capture_io do + puts 'hi' + warn 'bye!' + end - out, err = capture_io do - puts 'hi' - warn 'bye!' + assert_equal "hi\n", out + assert_equal "bye!\n", err end - - assert_equal "hi\n", out - assert_equal "bye!\n", err - ensure - $VERBOSE = orig_verbose end def test_capture_subprocess_io @assertion_count = 0 skip "Dunno why but the parallel run of this fails" - orig_verbose = $VERBOSE - $VERBOSE = false + non_verbose do + out, err = capture_subprocess_io do + system("echo 'hi'") + system("echo 'bye!' 1>&2") + end - out, err = capture_subprocess_io do - system("echo 'hi'") - system("echo 'bye!' 1>&2") + assert_equal "hi\n", out + assert_equal "bye!\n", err end - - assert_equal "hi\n", out - assert_equal "bye!\n", err - ensure - $VERBOSE = orig_verbose unless orig_verbose.nil? end def test_class_asserts_match_refutes -- cgit v1.2.3