aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-06-15 01:16:00 +0100
committerMax Howell2009-06-15 01:28:44 +0100
commit45106956b5bd70a6335a39f2600a32cbbefc41d5 (patch)
tree98f6fee2dd84c3488eac3a95196f383362f91868
parentdfee198fe8952440d52de68ff0aff2b8facd560c (diff)
downloadhomebrew-45106956b5bd70a6335a39f2600a32cbbefc41d5.tar.bz2
Capture stdout during test_prefix
-rwxr-xr-xLibrary/Homebrew/unittest.rb20
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