diff options
| author | Max Howell | 2009-06-15 01:16:00 +0100 |
|---|---|---|
| committer | Max Howell | 2009-06-15 01:28:44 +0100 |
| commit | 45106956b5bd70a6335a39f2600a32cbbefc41d5 (patch) | |
| tree | 98f6fee2dd84c3488eac3a95196f383362f91868 /Library | |
| parent | dfee198fe8952440d52de68ff0aff2b8facd560c (diff) | |
| download | homebrew-45106956b5bd70a6335a39f2600a32cbbefc41d5.tar.bz2 | |
Capture stdout during test_prefix
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 5ac1f994a..da2fedb88 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -3,6 +3,7 @@ $:.unshift File.dirname(__FILE__) require 'test/unit' require 'brewkit' +require 'stringio' class TestFormula <Formula def initialize url, md5='nomd5' @@ -12,6 +13,13 @@ class TestFormula <Formula end end +def nostdout + tmp=$stdout + $stdout=StringIO.new + yield + $stdout=tmp +end + class BeerTasting <Test::Unit::TestCase def test_version_all_dots @@ -86,12 +94,12 @@ class BeerTasting <Test::Unit::TestCase def test_prefix url='http://www.methylblue.com/test-0.1.tar.gz' md5='d496ea538a21dc4bb8524a8888baf88c' - - TestFormula.new(url, md5).brew do |f| - prefix=f.prefix - # we test for +/unittest/0.1 because we derive @name from $0 - assert_equal File.expand_path(prefix), ($cellar+'test'+'0.1').to_s - assert_kind_of Pathname, prefix + + nostdout do + TestFormula.new(url, md5).brew do |f| + assert_equal File.expand_path(f.prefix), ($cellar+f.name+'0.1').to_s + assert_kind_of Pathname, f.prefix + end end end end
\ No newline at end of file |
