diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-22 08:03:55 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-22 08:03:55 +0000 |
commit | a33353f8804211e6d0d98c180068c465f49cf242 (patch) | |
tree | db8e32accb485b196cf86e053ba8e77b8688f465 /test/test_prime.rb | |
parent | e2c1e2969df27a1bde0906139c723cdeaea979ab (diff) |
* test/test_prime.rb (TestPrime#test_new): the warning expected have
not been displayed when $VERBOSE == nil. Patch by Shota Fukumori
a.k.a. sora_h. [ruby-dev:42272]
Recovers $stderr even if StringIO.new fails. Reported by unak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_prime.rb')
-rw-r--r-- | test/test_prime.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test_prime.rb b/test/test_prime.rb index e095a29722..3dd1b89b2f 100644 --- a/test/test_prime.rb +++ b/test/test_prime.rb @@ -55,12 +55,13 @@ class TestPrime < Test::Unit::TestCase end def test_new - buf = StringIO.new('', 'w') - orig, $stderr = $stderr, buf + orig_stderr, orig_verbose = $stderr, $VERBOSE + + $stderr = buf = StringIO.new('', 'w') + $VERBOSE = false enum = Prime.new - assert !buf.string.empty? - $stderr = orig + assert_match("obsolete", buf.string) assert enum.respond_to?(:each) assert enum.kind_of?(Enumerable) @@ -68,7 +69,8 @@ class TestPrime < Test::Unit::TestCase assert Prime === enum ensure - $stderr = orig + $stderr = orig_stderr + $VERBOSE = orig_verbose end def test_enumerator_succ |