blob: a82b06f81399baecf264fc21fa8c1879b4443b53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require 'test/unit/assertions'
module Homebrew
module Assertions
include Test::Unit::Assertions
# Returns the output of running cmd, and asserts the exit status
def shell_output(cmd, result=0)
ohai cmd
output = `#{cmd}`
assert_equal result, $?.exitstatus
output
end
# Returns the output of running the cmd, with the optional input
def pipe_output(cmd, input=nil)
ohai cmd
IO.popen(cmd, "w+") do |pipe|
pipe.write(input) unless input.nil?
pipe.close_write
pipe.read
end
end
end
end
|