summaryrefslogtreecommitdiff
path: root/test/minitest
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:02:36 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:02:36 +0000
commit2dc5e62545eb18feb85b1fa321f19904704cc76f (patch)
tree2c6dc0d4827a10b8d37a42c61d36b3cdb5062b6a /test/minitest
parent213ba52407aa96d51e983579d61367991fc78d67 (diff)
Imported minitest 4.3.2 (r8027)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/minitest')
-rw-r--r--test/minitest/test_minitest_unit.rb43
1 files changed, 23 insertions, 20 deletions
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