use test helpers
parent
283f6ade9d
commit
1d9631c423
|
@ -19,11 +19,8 @@ class Aamath < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/aamath", "w+") do |pipe|
|
||||
pipe.write((prefix/"testcases").read)
|
||||
pipe.close_write
|
||||
assert_match /#{Regexp.escape("f(x + h) = f(x) + h f'(x)")}/, pipe.read
|
||||
end
|
||||
s = pipe_output("#{bin}/aamath", (prefix/"testcases").read)
|
||||
assert_match /#{Regexp.escape("f(x + h) = f(x) + h f'(x)")}/, s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,16 +14,8 @@ class AardvarkShellUtils < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/filebase movcpm.com`
|
||||
assert_equal "movcpm\n", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
|
||||
output = `#{bin}/fileext movcpm.com`
|
||||
assert_equal "com\n", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
|
||||
output = `#{bin}/realpath .`
|
||||
assert_equal "#{testpath}\n", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "movcpm", shell_output("#{bin}/filebase movcpm.com").strip
|
||||
assert_equal "com", shell_output("#{bin}/fileext movcpm.com").strip
|
||||
assert_equal testpath.to_s, shell_output("#{bin}/realpath .").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,10 +13,7 @@ class Ack < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/ack --noenv --nocolor bar -", "w+") do |pipe|
|
||||
pipe.write "foo\nfoo bar\nbaz"
|
||||
pipe.close_write
|
||||
assert_equal "foo bar\n", pipe.read
|
||||
end
|
||||
assert_equal "foo bar\n", pipe_output("#{bin}/ack --noenv --nocolor bar -",
|
||||
"foo\nfoo bar\nbaz")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,10 +11,7 @@ class Aha < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/aha", "w+") do |pipe|
|
||||
pipe.write("[35mrain[34mpill[00m")
|
||||
pipe.close_write
|
||||
assert_match /color:purple;">rain.*color:blue;">pill/, pipe.read
|
||||
end
|
||||
out = pipe_output(bin/"aha", "[35mrain[34mpill[00m")
|
||||
assert_match /color:purple;">rain.*color:blue;">pill/, out
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,8 +18,6 @@ class Algol68g < Formula
|
|||
print("Hello World")
|
||||
EOS
|
||||
|
||||
output = `#{bin}/a68g #{path}`.strip
|
||||
assert_equal "Hello World", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "Hello World", shell_output("#{bin}/a68g #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,10 +17,6 @@ class Align < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen(bin/"align", "w+") do |pipe|
|
||||
pipe.write "1 1\n12 12\n"
|
||||
pipe.close_write
|
||||
assert_equal " 1 1\n12 12\n", pipe.read
|
||||
end
|
||||
assert_equal " 1 1\n12 12\n", pipe_output(bin/"align", "1 1\n12 12\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,8 +22,6 @@ class Ansifilter < Formula
|
|||
path = testpath/"ansi.txt"
|
||||
path.write "f\x1b[31moo"
|
||||
|
||||
output = `#{bin}/ansifilter #{path}`.strip
|
||||
assert_equal "foo", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "foo", shell_output("#{bin}/ansifilter #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,8 +12,6 @@ class Ascii < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/ascii 0x0a`
|
||||
assert output.include?("Official name: Line Feed")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert shell_output(bin/"ascii 0x0a").include?("Official name: Line Feed")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,8 +31,6 @@ class Ats2Postiats < Formula
|
|||
implement main0 () = ()
|
||||
EOS
|
||||
system "#{bin}/patscc hello.dats -o hello"
|
||||
IO.popen("./hello", "r") do |pipe|
|
||||
assert_match "Hello, world!", pipe.read
|
||||
end
|
||||
assert_match "Hello, world!", shell_output(testpath/"hello")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class AutopanoSiftC < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
pipe = IO.popen("#{bin}/autopano-sift-c")
|
||||
assert_match /Version #{Regexp.escape(version)}/, pipe.read
|
||||
assert_match /Version #{Regexp.escape(version)}/,
|
||||
pipe_output("#{bin}/autopano-sift-c")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,6 +29,6 @@ class Avian < Formula
|
|||
}
|
||||
EOS
|
||||
system 'javac', 'Test.java'
|
||||
assert_equal 'OK', `avian Test`.strip
|
||||
assert_equal 'OK', shell_output("#{bin}/avian Test")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,9 +21,8 @@ class Avra < Formula
|
|||
|
||||
test do
|
||||
(testpath/"test.asm").write " .device attiny10\n ldi r16,0x42\n"
|
||||
output = `#{bin}/avra -l test.lst test.asm`
|
||||
output = shell_output("#{bin}/avra -l test.lst test.asm")
|
||||
assert output.include?("Assembly complete with no errors.")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert File.exist?("test.hex")
|
||||
assert File.read("test.lst").include?("ldi r16,0x42")
|
||||
end
|
||||
|
|
|
@ -15,9 +15,6 @@ class Base64 < Formula
|
|||
test do
|
||||
path = testpath/"a.txt"
|
||||
path.write "hello"
|
||||
|
||||
output = `#{bin}/base64 #{path}`.strip
|
||||
assert_equal "aGVsbG8=", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "aGVsbG8=", shell_output("#{bin}/base64 #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,9 +17,6 @@ class Basex < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/basex", "1 to 10") do |_, stdout, _|
|
||||
assert_equal "1 2 3 4 5 6 7 8 9 10", stdout.read
|
||||
end
|
||||
assert_equal "1 2 3 4 5 6 7 8 9 10", shell_output("#{bin}/basex '1 to 10'")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,8 +42,6 @@ class Bash < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/bash -c "echo hello"`.strip
|
||||
assert_equal "hello", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "hello", shell_output("#{bin}/bash -c \"echo hello\"").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,12 +12,10 @@ class Bgrep < Formula
|
|||
|
||||
test do
|
||||
path = testpath/"hi.prg"
|
||||
code = [0x00, 0xc0, 0xa9, 0x48, 0x20, 0xd2, 0xff,
|
||||
0xa9, 0x49, 0x20, 0xd2, 0xff, 0x60].pack("C*")
|
||||
path.open("wb") { |f| f.write code }
|
||||
path.binwrite [0x00, 0xc0, 0xa9, 0x48, 0x20, 0xd2, 0xff,
|
||||
0xa9, 0x49, 0x20, 0xd2, 0xff, 0x60].pack("C*")
|
||||
|
||||
lines = `#{bin}/bgrep 20d2ff #{path}`.strip.split("\n")
|
||||
assert_equal ["#{path}: 00000004", "#{path}: 00000009"], lines
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal ["#{path}: 00000004", "#{path}: 00000009"],
|
||||
shell_output("#{bin}/bgrep 20d2ff #{path}").split("\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,8 +43,6 @@ class Calc < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/calc 0xA + 1`.strip
|
||||
assert_equal "11", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "11", shell_output("#{bin}/calc 0xA + 1").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -117,18 +117,9 @@ class Cayley < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
|
||||
touch "test.nt"
|
||||
|
||||
Open3.popen3("#{bin}/cayley", "repl", "--dbpath=#{testpath}/test.nt") do |stdin, stdout, _|
|
||||
stdin.write "graph.Vertex().All()"
|
||||
stdin.close
|
||||
|
||||
result = stdout.read.strip
|
||||
|
||||
assert !result.include?("Error:")
|
||||
assert result.include?("Elapsed time:")
|
||||
end
|
||||
result = pipe_output("#{bin}/cayley repl --dbpath=#{testpath}/test.nt", "graph.Vertex().All()")
|
||||
assert !result.include?("Error:")
|
||||
assert result.include?("Elapsed time:")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,10 +11,6 @@ class Cbmbasic < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/cbmbasic", "w+") do |pipe|
|
||||
pipe.write("PRINT 1\n")
|
||||
pipe.close_write
|
||||
assert_match /READY.\r\n 1/, pipe.read
|
||||
end
|
||||
assert_match /READY.\r\n 1/, pipe_output("#{bin}/cbmbasic", "PRINT 1\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,8 +11,7 @@ class Ccal < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/ccal 2 2014`
|
||||
output = shell_output("#{bin}/ccal 2 2014")
|
||||
assert output.include?("Year JiaWu, Month 1X")
|
||||
assert_equal 0, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,8 +23,7 @@ class Cdecl < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/cdecl explain int *a`.strip
|
||||
assert_equal "declare a as pointer to int", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "declare a as pointer to int",
|
||||
shell_output("#{bin}/cdecl explain int *a").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,8 +28,7 @@ class CheckPostgres < Formula
|
|||
test do
|
||||
# This test verifies that check_postgres fails correctly, assuming
|
||||
# that no server is running at that port.
|
||||
output = `#{bin}/check_postgres --action=connection --port=65432`
|
||||
output = shell_output("#{bin}/check_postgres --action=connection --port=65432", 2)
|
||||
assert output.include? "POSTGRES_CONNECTION CRITICAL"
|
||||
assert_equal 2, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,8 +27,6 @@ class Chicken < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `'#{bin}/csi' -e '(print (* 5 5))'`
|
||||
assert_equal "25", output.strip
|
||||
assert $?.success?
|
||||
assert_equal "25", shell_output("#{bin}/csi -e '(print (* 5 5))'").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,7 @@ class Chkrootkit < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
assert_equal "chkrootkit version #{version}", `#{bin}/chkrootkit -V 2>&1`.strip
|
||||
assert_equal "chkrootkit version #{version}",
|
||||
shell_output("#{bin}/chkrootkit -V 2>&1", 1).strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,6 @@ class Cksfv < Formula
|
|||
path = testpath/"foo"
|
||||
path.write "abcd"
|
||||
|
||||
lines = `#{bin}/cksfv #{path}`.split("\n")
|
||||
assert lines.include?("#{path} ED82CD11")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert shell_output("#{bin}/cksfv #{path}").include?("#{path} ED82CD11")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,11 +61,7 @@ class Cloog < Formula
|
|||
0
|
||||
EOS
|
||||
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/cloog", "/dev/stdin") do |stdin, stdout, _|
|
||||
stdin.write(cloog_source)
|
||||
stdin.close
|
||||
assert_match /Generated from \/dev\/stdin by CLooG/, stdout.read
|
||||
end
|
||||
output = pipe_output("#{bin}/cloog /dev/stdin", cloog_source)
|
||||
assert_match /Generated from \/dev\/stdin by CLooG/, output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,9 +14,8 @@ class Cowsay < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/cowsay moo`
|
||||
output = shell_output("#{bin}/cowsay moo")
|
||||
assert output.include?("moo") # bubble
|
||||
assert output.include?("^__^") # cow
|
||||
assert_equal 0, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,8 +26,7 @@ class Cpmtools < Formula
|
|||
system "#{bin}/cpmcp -f ibm-3740 #{image} #{src} 0:foo"
|
||||
|
||||
# check for the file in the cp/m directory
|
||||
assert `#{bin}/cpmls -f ibm-3740 #{image}`.include?("foo")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert shell_output("#{bin}/cpmls -f ibm-3740 #{image}").include?("foo")
|
||||
|
||||
# copy the file back out of the image
|
||||
dest = testpath/"bar"
|
||||
|
|
|
@ -20,8 +20,6 @@ class CssCrush < Formula
|
|||
p { color: $(foo); }
|
||||
EOS
|
||||
|
||||
output = `#{bin}/csscrush #{path}`.strip
|
||||
assert_equal "p{color:#123456}", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "p{color:#123456}", shell_output("#{bin}/csscrush #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,10 +17,7 @@ class CsvFix < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/csvfix trim", "w+") do |pipe|
|
||||
pipe.write "foo , bar \n"
|
||||
pipe.close_write
|
||||
assert_equal %{"foo","bar"\n}, pipe.read
|
||||
end
|
||||
assert_equal %{"foo","bar"\n},
|
||||
pipe_output("#{bin}/csvfix trim", "foo , bar \n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,10 +13,7 @@ class Csvprintf < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/csvprintf -i '%2$s %1$s\n'", "w+") do |pipe|
|
||||
pipe.write "Last,First\nSmith,Fred\n"
|
||||
pipe.close_write
|
||||
assert_equal "Fred Smith\n", pipe.read
|
||||
end
|
||||
assert_equal "Fred Smith\n",
|
||||
pipe_output("#{bin}/csvprintf -i '%2$s %1$s\n'", "Last,First\nSmith,Fred\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,6 @@ class Dart < Formula
|
|||
}
|
||||
EOS
|
||||
|
||||
assert_equal "test message\n", `#{bin}/dart sample.dart`
|
||||
assert_equal "test message\n", shell_output("#{bin}/dart sample.dart")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ class Dasm < Formula
|
|||
EOS
|
||||
|
||||
system bin/"dasm", path
|
||||
code = File.open(testpath/"a.out", "rb") { |f| f.read.unpack("C*") }
|
||||
code = (testpath/"a.out").binread.unpack("C*")
|
||||
assert_equal [0x00, 0xc0, 0x4c, 0xe2, 0xfc], code
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,8 +19,7 @@ class Ddate < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
out = `#{bin}/ddate 20 6 2014`
|
||||
assert_equal "Sweetmorn, Confusion 25, 3180 YOLD\n", out
|
||||
assert_equal 0, $?.exitstatus
|
||||
output = shell_output("#{bin}/ddate 20 6 2014").strip
|
||||
assert_equal "Sweetmorn, Confusion 25, 3180 YOLD", output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,10 @@ require 'formula'
|
|||
|
||||
class Disktype < Formula
|
||||
homepage 'http://disktype.sourceforge.net/'
|
||||
head 'cvs://:pserver:anonymous:@disktype.cvs.sourceforge.net:/cvsroot/disktype:disktype'
|
||||
url 'https://downloads.sourceforge.net/project/disktype/disktype/9/disktype-9.tar.gz'
|
||||
sha1 '5ccc55d1c47f9a37becce7336c4aa3a7a43cc89c'
|
||||
|
||||
head 'cvs://:pserver:anonymous:@disktype.cvs.sourceforge.net:/cvsroot/disktype:disktype'
|
||||
|
||||
def install
|
||||
system "make"
|
||||
bin.install "disktype"
|
||||
|
@ -17,8 +16,7 @@ class Disktype < Formula
|
|||
path = testpath/"foo"
|
||||
path.write "1234"
|
||||
|
||||
output = `#{bin}/disktype #{path}`
|
||||
output = shell_output("#{bin}/disktype #{path}")
|
||||
assert output.include?("Regular file, size 4 bytes")
|
||||
assert_equal 0, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,8 @@ class Djvulibre < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
%x[#{bin}/djvused -e n #{share}/doc/djvu/lizard2002.djvu].chomp == "2" #should show count of 2 pages
|
||||
output = shell_output("#{bin}/djvused -e n #{share}/doc/djvu/lizard2002.djvu")
|
||||
assert_equal "2", output.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -28,6 +28,6 @@ class Dockutil < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
assert_equal "2.0.0", `#{bin}/dockutil --version`.strip
|
||||
assert_equal "2.0.0", shell_output("#{bin}/dockutil --version").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,7 @@ class Elinks < Formula
|
|||
Hello world!
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
EOS
|
||||
assert_match /^\s*Hello world!\n+ *1. one\n *2. two\s*$/, `elinks test.html`
|
||||
assert_match /^\s*Hello world!\n+ *1. one\n *2. two\s*$/,
|
||||
shell_output("elinks test.html")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -161,9 +161,7 @@ class Emacs < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `'#{bin}/emacs' --batch --eval="(print (+ 2 2))"`
|
||||
assert $?.success?
|
||||
assert_equal "4", output.strip
|
||||
assert_equal "4", shell_output("#{bin}/emacs --batch --eval=\"(print (+ 2 2))\"").strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ class Enscript < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/enscript", "-V") do |_, stdout, _|
|
||||
assert_match /GNU Enscript #{Regexp.escape(version)}/, stdout.read
|
||||
end
|
||||
assert_match /GNU Enscript #{Regexp.escape(version)}/,
|
||||
shell_output("#{bin}/enscript -V")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,6 @@ class Fakeroot < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
assert_equal `fakeroot whoami`, "root\n"
|
||||
assert_equal "root", shell_output("#{bin}/fakeroot whoami").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,8 +16,7 @@ class Fdupes < Formula
|
|||
touch "a"
|
||||
touch "b"
|
||||
|
||||
dupes = `#{bin}/fdupes .`.strip.split("\n").sort
|
||||
dupes = shell_output("#{bin}/fdupes .").strip.split("\n").sort
|
||||
assert_equal ["./a", "./b"], dupes
|
||||
assert_equal 0, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,6 @@ class Fzf < Formula
|
|||
|
||||
test do
|
||||
(testpath/"list").write %w[hello world].join($/)
|
||||
assert_equal "world", `cat #{testpath}/list | #{bin}/fzf -f wld`.chomp
|
||||
assert_equal "world", shell_output("cat #{testpath}/list | #{bin}/fzf -f wld").chomp
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Gawk < Formula
|
||||
homepage 'http://www.gnu.org/software/gawk/'
|
||||
url 'http://ftpmirror.gnu.org/gawk/gawk-4.1.1.tar.xz'
|
||||
mirror 'http://ftp.gnu.org/gnu/gawk/gawk-4.1.1.tar.xz'
|
||||
sha1 '547feb48d20e923aff58daccee97c94e047fdc18'
|
||||
homepage "http://www.gnu.org/software/gawk/"
|
||||
url "http://ftpmirror.gnu.org/gawk/gawk-4.1.1.tar.xz"
|
||||
mirror "http://ftp.gnu.org/gnu/gawk/gawk-4.1.1.tar.xz"
|
||||
sha1 "547feb48d20e923aff58daccee97c94e047fdc18"
|
||||
|
||||
bottle do
|
||||
sha1 "8fa017184dc02cdc122d5681b6824fd12be01def" => :mavericks
|
||||
|
@ -30,8 +30,7 @@ class Gawk < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `echo "Macrobrew" | '#{bin}/gawk' '{ gsub(/Macro/, "Home"); print }' -`
|
||||
output = pipe_output("#{bin}/gawk '{ gsub(/Macro/, \"Home\"); print }' -", "Macrobrew")
|
||||
assert_equal 'Homebrew', output.strip
|
||||
assert_equal 0, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,10 +12,7 @@ class GitTracker < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/git-tracker", "help") do |_, stdout, _|
|
||||
install_message = /\Agit-tracker \d+(\.\d+)* is installed\.\z/
|
||||
assert install_message.match(stdout.readline.strip), "git-tracker is not installed"
|
||||
end
|
||||
output = shell_output("#{bin}/git-tracker help")
|
||||
assert_match /git-tracker \d+(\.\d+)* is installed\./, output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,9 +15,7 @@ class Gptfdisk < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{sbin}/gdisk", "w+") do |pipe|
|
||||
pipe.write("\n")
|
||||
assert_match /GPT fdisk \(gdisk\) version #{Regexp.escape(version)}/, pipe.read
|
||||
end
|
||||
assert_match /GPT fdisk \(gdisk\) version #{Regexp.escape(version)}/,
|
||||
pipe_output("#{sbin}/gdisk", "\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,9 +13,6 @@ class Htmlcleaner < Formula
|
|||
test do
|
||||
path = testpath/"index.html"
|
||||
path.write "<html>"
|
||||
|
||||
output = `#{bin}/htmlcleaner src=#{path}`
|
||||
assert output.include?("</html>")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert shell_output("#{bin}/htmlcleaner src=#{path}").include?("</html>")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ class Hub < Formula
|
|||
|
||||
test do
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
assert_equal 'bin/brew', `#{bin}/hub ls-files -- bin`.strip
|
||||
assert_equal "bin/brew", shell_output("#{bin}/hub ls-files -- bin").strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,10 +19,7 @@ class Iozone < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/iozone", "-I", "-s", "16M") do |_, stdout, _|
|
||||
assert_match /File size set to 16384 kB/, stdout.read
|
||||
end
|
||||
assert_match /File size set to 16384 kB/, shell_output("#{bin}/iozone -I -s 16M")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,10 +11,6 @@ class Javarepl < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen(bin/"javarepl", "w+") do |pipe|
|
||||
pipe.write "System.out.println(64*1024)\n:quit\n"
|
||||
pipe.close_write
|
||||
assert pipe.read.include?("65536")
|
||||
end
|
||||
assert pipe_output("#{bin}/javarepl", "System.out.println(64*1024)\n:quit\n").include?("65536")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,10 +25,6 @@ class Jq < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/jq .bar", "w+") do |pipe|
|
||||
pipe.puts '{"foo":1, "bar":2}'
|
||||
pipe.close_write
|
||||
assert_equal "2\n", pipe.read
|
||||
end
|
||||
assert_equal "2\n", pipe_output("#{bin}/jq .bar", '{"foo":1, "bar":2}')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,11 +15,6 @@ class Jshon < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/jshon", "-l") do |stdin, stdout, _|
|
||||
stdin.write("[true,false,null]")
|
||||
stdin.close
|
||||
assert_equal "3", stdout.read.strip
|
||||
end
|
||||
assert_equal "3", pipe_output("#{bin}/jshon -l", "[true,false,null]").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Jslint4java < Formula
|
||||
homepage 'http://code.google.com/p/jslint4java/'
|
||||
url 'https://jslint4java.googlecode.com/files/jslint4java-2.0.5-dist.zip'
|
||||
sha1 '30a75ce48b64d2c8f0b2b86e20c0d98e6441827d'
|
||||
homepage "http://code.google.com/p/jslint4java/"
|
||||
url "https://jslint4java.googlecode.com/files/jslint4java-2.0.5-dist.zip"
|
||||
sha1 "30a75ce48b64d2c8f0b2b86e20c0d98e6441827d"
|
||||
|
||||
def install
|
||||
doc.install Dir['docs/*']
|
||||
libexec.install Dir['*.jar']
|
||||
bin.write_jar_script Dir[libexec/'jslint4java*.jar'].first, 'jslint4java'
|
||||
doc.install Dir["docs/*"]
|
||||
libexec.install Dir["*.jar"]
|
||||
bin.write_jar_script Dir[libexec/"jslint4java*.jar"].first, "jslint4java"
|
||||
end
|
||||
|
||||
test do
|
||||
|
@ -17,9 +17,7 @@ class Jslint4java < Formula
|
|||
var i = 0;
|
||||
var j = 1 // no semicolon
|
||||
EOS
|
||||
|
||||
output = `#{bin}/jslint4java #{path}`
|
||||
output = shell_output("#{bin}/jslint4java #{path}", 1)
|
||||
assert output.include?("2:10:Expected ';' and instead saw '(end)'")
|
||||
assert_equal 1, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,10 +12,6 @@ class Jsmin < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/jsmin", "w+") do |pipe|
|
||||
pipe.puts "var i = 0; // comment"
|
||||
pipe.close_write
|
||||
assert_equal "\nvar i=0;", pipe.read
|
||||
end
|
||||
assert_equal "\nvar i=0;", pipe_output(bin/"jsmin", "var i = 0; // comment")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,15 +11,12 @@ class Jsonpp < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/jsonpp", "w+") do |pipe|
|
||||
pipe.puts '{"foo":"bar","baz":"qux"}'
|
||||
pipe.close_write
|
||||
assert_equal <<-EOS.undent, pipe.read
|
||||
{
|
||||
"foo": "bar",
|
||||
"baz": "qux"
|
||||
}
|
||||
EOS
|
||||
end
|
||||
expected = <<-EOS.undent.chomp
|
||||
{
|
||||
"foo": "bar",
|
||||
"baz": "qux"
|
||||
}
|
||||
EOS
|
||||
assert_equal expected, pipe_output(bin/"jsonpp", '{"foo":"bar","baz":"qux"}')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,6 @@ class Libvbucket < Formula
|
|||
|
||||
test do
|
||||
require 'utils/json'
|
||||
require 'open3'
|
||||
json = Utils::JSON.dump(
|
||||
{
|
||||
"hashAlgorithm" => "CRC",
|
||||
|
@ -37,10 +36,7 @@ class Libvbucket < Formula
|
|||
key: world master: server2:11210 vBucketId: 3 couchApiBase: (null) replicas: server3:11211 server1:11211
|
||||
EOS
|
||||
|
||||
Open3.popen3("#{bin}/vbuckettool", "-", "hello", "world") do |stdin, stdout, _|
|
||||
stdin.write(json)
|
||||
stdin.close
|
||||
assert_equal expected, stdout.read
|
||||
end
|
||||
output = pipe_output("#{bin}/vbuckettool - hello world", json)
|
||||
assert_equal expected, output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,8 +12,6 @@ class Lorem < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/lorem -n 2`
|
||||
assert_equal "lorem ipsum\n", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "lorem ipsum", shell_output("#{bin}/lorem -n 2").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,10 +13,6 @@ class Markdown < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/markdown", "w+") do |pipe|
|
||||
pipe.write "foo *bar*\n"
|
||||
pipe.close_write
|
||||
assert_equal "<p>foo <em>bar</em></p>\n", pipe.read
|
||||
end
|
||||
assert_equal "<p>foo <em>bar</em></p>\n", pipe_output("#{bin}/markdown", "foo *bar*\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,9 +17,7 @@ class Mp3fs < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require "open3"
|
||||
Open3.popen3("#{bin}/mp3fs", "-V") do |_, stdout, _|
|
||||
assert_match /MP3FS version #{Regexp.escape(version)}/, stdout.read
|
||||
end
|
||||
assert_match /mp3fs version: #{Regexp.escape(version)}/,
|
||||
shell_output("#{bin}/mp3fs -V")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,10 +24,7 @@ class Msitools < Formula
|
|||
|
||||
test do
|
||||
# wixl-heat: make an xml fragment
|
||||
IO.popen("#{bin}/wixl-heat --prefix test", "w+") do |pipe|
|
||||
pipe.close_write
|
||||
assert pipe.read.include?("<Fragment>")
|
||||
end
|
||||
assert pipe_output("#{bin}/wixl-heat --prefix test").include?("<Fragment>")
|
||||
|
||||
# wixl: build two installers
|
||||
1.upto(2) do |i|
|
||||
|
|
|
@ -22,10 +22,6 @@ class Multimarkdown < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen(bin/"mmd", "w+") do |pipe|
|
||||
pipe.write "foo *bar*\n"
|
||||
pipe.close_write
|
||||
assert_equal "<p>foo <em>bar</em></p>\n", pipe.read
|
||||
end
|
||||
assert_equal "<p>foo <em>bar</em></p>\n", pipe_output(bin/"mmd", "foo *bar*\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,8 +17,6 @@ class NewickUtils < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
|
||||
expected = <<-EOS
|
||||
+-------------------------------------+ B
|
||||
=| A
|
||||
|
@ -29,11 +27,8 @@ class NewickUtils < Formula
|
|||
substitutions/site
|
||||
EOS
|
||||
|
||||
Open3.popen3("#{bin}/nw_display", "-") do |stdin, stdout, _|
|
||||
stdin.write("(B:1,C:2)A;\n")
|
||||
stdin.close
|
||||
assert_equal expected, stdout.read.split("\n").map(&:rstrip).join("\n")
|
||||
end
|
||||
output = pipe_output("#{bin}/nw_display -", "(B:1,C:2)A;\n")
|
||||
assert_equal expected, output.split("\n").map(&:rstrip).join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Newlisp < Formula
|
||||
homepage 'http://www.newlisp.org/'
|
||||
url 'http://www.newlisp.org/downloads/newlisp-10.6.0.tgz'
|
||||
sha1 '0f5ce581d070ff171cbef504308e578885aa5e72'
|
||||
homepage "http://www.newlisp.org/"
|
||||
url "http://www.newlisp.org/downloads/newlisp-10.6.0.tgz"
|
||||
sha1 "0f5ce581d070ff171cbef504308e578885aa5e72"
|
||||
|
||||
depends_on 'readline'
|
||||
depends_on "readline"
|
||||
|
||||
patch :DATA
|
||||
|
||||
|
@ -32,9 +32,7 @@ class Newlisp < Formula
|
|||
(exit 0)
|
||||
EOS
|
||||
|
||||
output = `#{bin}/newlisp #{path}`
|
||||
assert_equal "hello\n", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "hello\n", shell_output("#{bin}/newlisp #{path}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ class Nodebrew < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("nodebrew ls-remote") do |pipe|
|
||||
assert pipe.read.include?("v0.10.0")
|
||||
end
|
||||
assert shell_output("#{bin}/nodebrew ls-remote").include?("v0.10.0")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -32,8 +32,6 @@ class Phantomjs < Formula
|
|||
phantom.exit();
|
||||
EOS
|
||||
|
||||
output = `#{bin}/phantomjs #{path}`.strip
|
||||
assert_equal "hello", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "hello", shell_output("#{bin}/phantomjs #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,9 +14,6 @@ class Picolisp < Formula
|
|||
test do
|
||||
path = testpath/"hello.lisp"
|
||||
path.write '(prinl "Hello world") (bye)'
|
||||
|
||||
out = `#{bin}/picolisp #{path}`
|
||||
assert_equal "Hello world\n", out
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "Hello world\n", shell_output("#{bin}/picolisp #{path}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Pidcat < Formula
|
||||
homepage 'https://github.com/JakeWharton/pidcat'
|
||||
url 'https://github.com/JakeWharton/pidcat/archive/1.4.1.tar.gz'
|
||||
sha1 '89f806ae1fa3375ce188851c8c95fc1097467b82'
|
||||
head 'https://github.com/JakeWharton/pidcat.git'
|
||||
homepage "https://github.com/JakeWharton/pidcat"
|
||||
head "https://github.com/JakeWharton/pidcat.git"
|
||||
url "https://github.com/JakeWharton/pidcat/archive/1.4.1.tar.gz"
|
||||
sha1 "89f806ae1fa3375ce188851c8c95fc1097467b82"
|
||||
|
||||
def install
|
||||
bin.install 'pidcat.py' => 'pidcat'
|
||||
bin.install "pidcat.py" => "pidcat"
|
||||
end
|
||||
|
||||
test do
|
||||
output = `#{bin}/pidcat --help`.strip
|
||||
assert_match /^usage: pidcat/, output
|
||||
assert_match /^usage: pidcat/, shell_output("#{bin}/pidcat --help").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -108,8 +108,6 @@ class Pike < Formula
|
|||
}
|
||||
EOS
|
||||
|
||||
out = `#{bin}/pike #{path}`
|
||||
assert_equal "0123456789", out
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "0123456789", shell_output("#{bin}/pike #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
17
Formula/q.rb
17
Formula/q.rb
|
@ -1,20 +1,17 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Q < Formula
|
||||
homepage 'https://github.com/harelba/q'
|
||||
url 'https://github.com/harelba/q/archive/1.4.0.tar.gz'
|
||||
sha1 'e8efe87aa691a7ab57e95f15cf4b2babfbabe945'
|
||||
homepage "https://github.com/harelba/q"
|
||||
url "https://github.com/harelba/q/archive/1.4.0.tar.gz"
|
||||
sha1 "e8efe87aa691a7ab57e95f15cf4b2babfbabe945"
|
||||
|
||||
def install
|
||||
bin.install 'bin/q'
|
||||
bin.install "bin/q"
|
||||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/q 'select sum(c1) from -'", "w+") do |pipe|
|
||||
1.upto(100) { |i| pipe.puts i }
|
||||
pipe.close_write
|
||||
assert_equal "5050\n", pipe.read
|
||||
end
|
||||
output = shell_output("seq 1 100 | #{bin}/q 'select sum(c1) from -'")
|
||||
assert_equal "5050\n", output
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -61,8 +61,6 @@ class Scala < Formula
|
|||
}
|
||||
}
|
||||
EOS
|
||||
output = `'#{bin}/scala' #{file}`
|
||||
assert_equal "4", output.strip
|
||||
assert $?.success?
|
||||
assert_equal "4", shell_output("#{bin}/scala #{file}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,9 +47,6 @@ class Spidermonkey < Formula
|
|||
test do
|
||||
path = testpath/"test.js"
|
||||
path.write "print('hello');"
|
||||
|
||||
output = `#{bin}/js #{path}`.strip
|
||||
assert_equal "hello", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "hello", shell_output("#{bin}/js #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,6 +35,6 @@ class Tpp < Formula
|
|||
|
||||
test do
|
||||
assert_equal "tpp - text presentation program #{version}",
|
||||
`#{bin}/tpp --version`.chomp
|
||||
shell_output("#{bin}/tpp --version", 1).chomp
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class UcspiTcp < Formula
|
||||
homepage 'http://cr.yp.to/ucspi-tcp.html'
|
||||
url 'http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz'
|
||||
sha1 '793b4189795b563085602c030dd8aa0d206ddc0e'
|
||||
homepage "http://cr.yp.to/ucspi-tcp.html"
|
||||
url "http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz"
|
||||
sha1 "793b4189795b563085602c030dd8aa0d206ddc0e"
|
||||
|
||||
patch do
|
||||
url "http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2"
|
||||
|
@ -11,8 +11,8 @@ class UcspiTcp < Formula
|
|||
end
|
||||
|
||||
def install
|
||||
(buildpath/'conf-home').unlink
|
||||
(buildpath/'conf-home').write prefix
|
||||
(buildpath/"conf-home").unlink
|
||||
(buildpath/"conf-home").write prefix
|
||||
|
||||
system "make"
|
||||
system "make setup check"
|
||||
|
@ -20,8 +20,7 @@ class UcspiTcp < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
out = `#{bin}/tcpserver 2>&1`
|
||||
out = shell_output("#{bin}/tcpserver 2>&1", 100)
|
||||
assert out.include?("usage: tcpserver")
|
||||
assert_equal 100, $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,10 +16,6 @@ class Udis86 < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
IO.popen("#{bin}/udcli -x", "w+") do |pipe|
|
||||
pipe.write "cd 80"
|
||||
pipe.close_write
|
||||
assert pipe.read.include?("int 0x80")
|
||||
end
|
||||
assert pipe_output("#{bin}/udcli -x", "cd 80").include?("int 0x80")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,10 +44,7 @@ class Unac < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require 'open3'
|
||||
Open3.popen3("#{bin}/unaccent", "utf-8", "fóó") do |_, stdout, _|
|
||||
assert_equal "foo", stdout.read.strip
|
||||
end
|
||||
assert_equal "foo", shell_output("#{bin}/unaccent utf-8 fóó").strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ class Vala < Formula
|
|||
system "#{bin}/valac", *valac_args
|
||||
assert File.exist?(testpath/"hello.c")
|
||||
|
||||
output = `#{testpath}/hello`
|
||||
assert_equal test_string, output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal test_string, shell_output("#{testpath}/hello")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
require 'formula'
|
||||
require "formula"
|
||||
|
||||
class Veraxx < Formula
|
||||
homepage 'https://bitbucket.org/verateam/vera'
|
||||
url 'https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1.tar.gz'
|
||||
sha1 '0bf7d463dabe41c2069dbe2fa4f7fca192cb7d6e'
|
||||
homepage "https://bitbucket.org/verateam/vera"
|
||||
url "https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1.tar.gz"
|
||||
sha1 "0bf7d463dabe41c2069dbe2fa4f7fca192cb7d6e"
|
||||
|
||||
depends_on 'cmake' => :build
|
||||
depends_on 'boost'
|
||||
depends_on "cmake" => :build
|
||||
depends_on "boost"
|
||||
|
||||
# Use prebuilt docs to avoid need for pandoc
|
||||
resource 'doc' do
|
||||
url 'https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1-doc.tar.gz'
|
||||
sha1 'fce30676c815b99aa66d25c9dfbd2eda2c74bd7a'
|
||||
resource "doc" do
|
||||
url "https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1-doc.tar.gz"
|
||||
sha1 "fce30676c815b99aa66d25c9dfbd2eda2c74bd7a"
|
||||
end
|
||||
|
||||
def install
|
||||
system "cmake", ".", *std_cmake_args
|
||||
system "make install"
|
||||
|
||||
resource('doc').stage do
|
||||
man1.install 'vera++.1'
|
||||
doc.install 'vera++.html'
|
||||
resource("doc").stage do
|
||||
man1.install "vera++.1"
|
||||
doc.install "vera++.html"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
assert_equal version.to_s, `#{bin}/vera++ --version`.strip
|
||||
assert_equal version.to_s, shell_output("#{bin}/vera++ --version").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,8 +22,7 @@ class Wdiff < Formula
|
|||
b = testpath/"b.txt"
|
||||
b.write "The package manager for OS X"
|
||||
|
||||
out = `#{bin}/wdiff #{a} #{b}`
|
||||
assert_equal "The [-missing-] package manager for OS X", out
|
||||
assert_equal 1, $?.exitstatus
|
||||
output = shell_output("#{bin}/wdiff #{a} #{b}", 1)
|
||||
assert_equal "The [-missing-] package manager for OS X", output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,7 +107,7 @@ class Wireshark < Formula
|
|||
|
||||
test do
|
||||
system "#{bin}/randpkt", "-b", "100", "-c", "2", "capture.pcap"
|
||||
output = `#{bin}/capinfos -Tmc capture.pcap`
|
||||
output = shell_output("#{bin}/capinfos -Tmc capture.pcap")
|
||||
assert_equal "File name,Number of packets\ncapture.pcap,2\n", output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,8 +17,7 @@ class Xmlsh < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
out = `#{bin}/xmlsh -c 'x=<[<foo bar="baz" />]> && echo <[$x/@bar]>'`
|
||||
assert_equal "baz\n", out
|
||||
assert_equal 0, $?.exitstatus
|
||||
output = shell_output("#{bin}/xmlsh -c 'x=<[<foo bar=\"baz\" />]> && echo <[$x/@bar]>'")
|
||||
assert_equal "baz\n", output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,8 +24,7 @@ class Yajl < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
output = `echo "[0,1,2,3]" | '#{bin}/json_verify'`
|
||||
assert $?.success?
|
||||
assert_match /valid/i, output.strip
|
||||
output = pipe_output("#{bin}/json_verify", "[0,1,2,3]").strip
|
||||
assert_equal "JSON is valid", output
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,8 +41,6 @@ class Yara < Formula
|
|||
program = testpath/"zero.prg"
|
||||
program.binwrite [0x00, 0xc0, 0xa9, 0x30, 0x4c, 0xd2, 0xff].pack("C*")
|
||||
|
||||
out = `#{bin}/yara #{rules} #{program}`
|
||||
assert_equal "chrout #{program}\n", out
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "chrout #{program}", shell_output("#{bin}/yara #{rules} #{program}").strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,6 @@ class YleDl < Formula
|
|||
|
||||
test do
|
||||
assert_match /rtmpdump: This program dumps the media content streamed over RTMP/,
|
||||
`#{bin}/yle-dl --help 2>&1`.strip
|
||||
shell_output("#{bin}/yle-dl --help 2>&1")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,6 @@ class Z80dasm < Formula
|
|||
path = testpath/"a.bin"
|
||||
path.binwrite [0xcd, 0x34, 0x12].pack("c*")
|
||||
|
||||
output = `#{bin}/z80dasm #{path}`.strip
|
||||
assert output.include?("call 01234h")
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert shell_output("#{bin}/z80dasm #{path}").include?("call 01234h")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,8 +25,6 @@ class Zxcc < Formula
|
|||
path = testpath/"hello.com"
|
||||
path.binwrite code
|
||||
|
||||
output = `#{bin}/zxcc #{path}`.strip
|
||||
assert_equal "Hello", output
|
||||
assert_equal 0, $?.exitstatus
|
||||
assert_equal "Hello", shell_output("#{bin}/zxcc #{path}").strip
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue