File: assert_warning.rb

package info (click to toggle)
coderay 1.1.3-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,368 kB
  • sloc: ruby: 9,987; makefile: 14; sh: 4; python: 1
file content (15 lines) | stat: -rw-r--r-- 305 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Test::Unit::TestCase
  
  def assert_warning expected_warning
    require 'stringio'
    oldstderr = $stderr
    $stderr = StringIO.new
    yield
    $stderr.rewind
    given_warning = $stderr.read.chomp
    assert_equal expected_warning, given_warning
  ensure
    $stderr = oldstderr
  end
  
end