mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Capture stdout during test_prefix
This commit is contained in:
parent
eaad8393fd
commit
02e53d44cb
@ -3,6 +3,7 @@
|
|||||||
$:.unshift File.dirname(__FILE__)
|
$:.unshift File.dirname(__FILE__)
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'brewkit'
|
require 'brewkit'
|
||||||
|
require 'stringio'
|
||||||
|
|
||||||
class TestFormula <Formula
|
class TestFormula <Formula
|
||||||
def initialize url, md5='nomd5'
|
def initialize url, md5='nomd5'
|
||||||
@ -12,6 +13,13 @@ class TestFormula <Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nostdout
|
||||||
|
tmp=$stdout
|
||||||
|
$stdout=StringIO.new
|
||||||
|
yield
|
||||||
|
$stdout=tmp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
class BeerTasting <Test::Unit::TestCase
|
class BeerTasting <Test::Unit::TestCase
|
||||||
def test_version_all_dots
|
def test_version_all_dots
|
||||||
@ -87,11 +95,11 @@ class BeerTasting <Test::Unit::TestCase
|
|||||||
url='http://www.methylblue.com/test-0.1.tar.gz'
|
url='http://www.methylblue.com/test-0.1.tar.gz'
|
||||||
md5='d496ea538a21dc4bb8524a8888baf88c'
|
md5='d496ea538a21dc4bb8524a8888baf88c'
|
||||||
|
|
||||||
|
nostdout do
|
||||||
TestFormula.new(url, md5).brew do |f|
|
TestFormula.new(url, md5).brew do |f|
|
||||||
prefix=f.prefix
|
assert_equal File.expand_path(f.prefix), ($cellar+f.name+'0.1').to_s
|
||||||
# we test for +/unittest/0.1 because we derive @name from $0
|
assert_kind_of Pathname, f.prefix
|
||||||
assert_equal File.expand_path(prefix), ($cellar+'test'+'0.1').to_s
|
end
|
||||||
assert_kind_of Pathname, prefix
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user