Skip to content

Commit

Permalink
* test/test_prime.rb (TestPrime#test_new): the warning expected have
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
yugui committed Sep 22, 2010
1 parent e2c1e29 commit a33353f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Wed Sep 22 16:59:40 2010 Yuki Sonoda (Yugui) <[email protected]>

* 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.

Wed Sep 22 01:55:48 2010 Koichi Sasada <[email protected]>

* bootstraptest/test_method.rb: fix last commit.
Expand Down
12 changes: 7 additions & 5 deletions test/test_prime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ def test_each_without_block
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)
assert enum.respond_to?(:succ)

assert Prime === enum
ensure
$stderr = orig
$stderr = orig_stderr
$VERBOSE = orig_verbose
end

def test_enumerator_succ
Expand Down

0 comments on commit a33353f

Please sign in to comment.