diff options
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/README | 1 | ||||
-rw-r--r-- | test/lib/assert_warning.rb | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/test/lib/README b/test/lib/README index 7d7a0a0..7c41648 100644 --- a/test/lib/README +++ b/test/lib/README @@ -1,3 +1,2 @@ Contents: - test/unit: We need the old Test::Unit for the scanner test suite to work with Ruby 1.9. -- term/ansicolor: Used for colorful output of the scanner tests.
\ No newline at end of file diff --git a/test/lib/assert_warning.rb b/test/lib/assert_warning.rb new file mode 100644 index 0000000..828b464 --- /dev/null +++ b/test/lib/assert_warning.rb @@ -0,0 +1,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 |