diff options
85 files changed, 167 insertions, 346 deletions
| diff --git a/Library/Formula/aamath.rb b/Library/Formula/aamath.rb index 219fef1f7..ace2b8406 100644 --- a/Library/Formula/aamath.rb +++ b/Library/Formula/aamath.rb @@ -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 diff --git a/Library/Formula/aardvark_shell_utils.rb b/Library/Formula/aardvark_shell_utils.rb index d900ae987..b436df594 100644 --- a/Library/Formula/aardvark_shell_utils.rb +++ b/Library/Formula/aardvark_shell_utils.rb @@ -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 diff --git a/Library/Formula/ack.rb b/Library/Formula/ack.rb index 23a328350..2dc6f6d50 100644 --- a/Library/Formula/ack.rb +++ b/Library/Formula/ack.rb @@ -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 diff --git a/Library/Formula/aha.rb b/Library/Formula/aha.rb index acf6d8205..3b8b4348f 100644 --- a/Library/Formula/aha.rb +++ b/Library/Formula/aha.rb @@ -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 diff --git a/Library/Formula/algol68g.rb b/Library/Formula/algol68g.rb index 7706fb785..d04172d33 100644 --- a/Library/Formula/algol68g.rb +++ b/Library/Formula/algol68g.rb @@ -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 diff --git a/Library/Formula/align.rb b/Library/Formula/align.rb index d2d808fd4..0d8752d21 100644 --- a/Library/Formula/align.rb +++ b/Library/Formula/align.rb @@ -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 diff --git a/Library/Formula/ansifilter.rb b/Library/Formula/ansifilter.rb index a4b4b3e96..ac993a249 100644 --- a/Library/Formula/ansifilter.rb +++ b/Library/Formula/ansifilter.rb @@ -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 diff --git a/Library/Formula/ascii.rb b/Library/Formula/ascii.rb index e50e11ec9..894e30b2f 100644 --- a/Library/Formula/ascii.rb +++ b/Library/Formula/ascii.rb @@ -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 diff --git a/Library/Formula/ats2-postiats.rb b/Library/Formula/ats2-postiats.rb index 9117d2b36..ec7892ec9 100644 --- a/Library/Formula/ats2-postiats.rb +++ b/Library/Formula/ats2-postiats.rb @@ -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 diff --git a/Library/Formula/autopano-sift-c.rb b/Library/Formula/autopano-sift-c.rb index 95b6dac25..8f7aca75c 100644 --- a/Library/Formula/autopano-sift-c.rb +++ b/Library/Formula/autopano-sift-c.rb @@ -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 diff --git a/Library/Formula/avian.rb b/Library/Formula/avian.rb index e12f2cb49..c5401dc5a 100644 --- a/Library/Formula/avian.rb +++ b/Library/Formula/avian.rb @@ -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 diff --git a/Library/Formula/avra.rb b/Library/Formula/avra.rb index 0d2226886..77bc21c84 100644 --- a/Library/Formula/avra.rb +++ b/Library/Formula/avra.rb @@ -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 diff --git a/Library/Formula/base64.rb b/Library/Formula/base64.rb index 9e74e8079..183424f68 100644 --- a/Library/Formula/base64.rb +++ b/Library/Formula/base64.rb @@ -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 diff --git a/Library/Formula/basex.rb b/Library/Formula/basex.rb index f02cdb1b1..4888d02da 100644 --- a/Library/Formula/basex.rb +++ b/Library/Formula/basex.rb @@ -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 diff --git a/Library/Formula/bash.rb b/Library/Formula/bash.rb index 313451361..b6c54f0a2 100644 --- a/Library/Formula/bash.rb +++ b/Library/Formula/bash.rb @@ -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 diff --git a/Library/Formula/bgrep.rb b/Library/Formula/bgrep.rb index 19fca5142..0f4445695 100644 --- a/Library/Formula/bgrep.rb +++ b/Library/Formula/bgrep.rb @@ -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 diff --git a/Library/Formula/calc.rb b/Library/Formula/calc.rb index 4932a1b94..5c365a59c 100644 --- a/Library/Formula/calc.rb +++ b/Library/Formula/calc.rb @@ -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 diff --git a/Library/Formula/cayley.rb b/Library/Formula/cayley.rb index c04cee66a..8042b97f1 100644 --- a/Library/Formula/cayley.rb +++ b/Library/Formula/cayley.rb @@ -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 diff --git a/Library/Formula/cbmbasic.rb b/Library/Formula/cbmbasic.rb index 9780964a3..029cc30cd 100644 --- a/Library/Formula/cbmbasic.rb +++ b/Library/Formula/cbmbasic.rb @@ -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 diff --git a/Library/Formula/ccal.rb b/Library/Formula/ccal.rb index 03472d3af..9c3fd9317 100644 --- a/Library/Formula/ccal.rb +++ b/Library/Formula/ccal.rb @@ -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 diff --git a/Library/Formula/cdecl.rb b/Library/Formula/cdecl.rb index 62abcfcab..21ad7f844 100644 --- a/Library/Formula/cdecl.rb +++ b/Library/Formula/cdecl.rb @@ -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 diff --git a/Library/Formula/check_postgres.rb b/Library/Formula/check_postgres.rb index c33cf4720..84a59a12b 100644 --- a/Library/Formula/check_postgres.rb +++ b/Library/Formula/check_postgres.rb @@ -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 diff --git a/Library/Formula/chicken.rb b/Library/Formula/chicken.rb index 29314af4b..66361eb1f 100644 --- a/Library/Formula/chicken.rb +++ b/Library/Formula/chicken.rb @@ -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 diff --git a/Library/Formula/chkrootkit.rb b/Library/Formula/chkrootkit.rb index 2f77fb4b1..1d1f0990f 100644 --- a/Library/Formula/chkrootkit.rb +++ b/Library/Formula/chkrootkit.rb @@ -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 diff --git a/Library/Formula/cksfv.rb b/Library/Formula/cksfv.rb index c0cf4f1c5..89df75345 100644 --- a/Library/Formula/cksfv.rb +++ b/Library/Formula/cksfv.rb @@ -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 diff --git a/Library/Formula/cloog.rb b/Library/Formula/cloog.rb index f07b6904d..fb3c26ad3 100644 --- a/Library/Formula/cloog.rb +++ b/Library/Formula/cloog.rb @@ -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 diff --git a/Library/Formula/cowsay.rb b/Library/Formula/cowsay.rb index 4085897ee..2ac4807a5 100644 --- a/Library/Formula/cowsay.rb +++ b/Library/Formula/cowsay.rb @@ -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 diff --git a/Library/Formula/cpmtools.rb b/Library/Formula/cpmtools.rb index 5864ded8c..c584a0a4f 100644 --- a/Library/Formula/cpmtools.rb +++ b/Library/Formula/cpmtools.rb @@ -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" diff --git a/Library/Formula/css-crush.rb b/Library/Formula/css-crush.rb index 6ea634ba5..beaab2413 100644 --- a/Library/Formula/css-crush.rb +++ b/Library/Formula/css-crush.rb @@ -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 diff --git a/Library/Formula/csv-fix.rb b/Library/Formula/csv-fix.rb index 7bad9e3dc..ad5539b92 100644 --- a/Library/Formula/csv-fix.rb +++ b/Library/Formula/csv-fix.rb @@ -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 diff --git a/Library/Formula/csvprintf.rb b/Library/Formula/csvprintf.rb index 930deeeb0..e04088675 100644 --- a/Library/Formula/csvprintf.rb +++ b/Library/Formula/csvprintf.rb @@ -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 diff --git a/Library/Formula/dart.rb b/Library/Formula/dart.rb index f347781db..f31b77117 100644 --- a/Library/Formula/dart.rb +++ b/Library/Formula/dart.rb @@ -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 diff --git a/Library/Formula/dasm.rb b/Library/Formula/dasm.rb index 83c84ece6..d2d960fbc 100644 --- a/Library/Formula/dasm.rb +++ b/Library/Formula/dasm.rb @@ -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 diff --git a/Library/Formula/ddate.rb b/Library/Formula/ddate.rb index ad8322ac7..a2f6a65af 100644 --- a/Library/Formula/ddate.rb +++ b/Library/Formula/ddate.rb @@ -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 diff --git a/Library/Formula/disktype.rb b/Library/Formula/disktype.rb index 07c95da21..e89ab1642 100644 --- a/Library/Formula/disktype.rb +++ b/Library/Formula/disktype.rb @@ -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 diff --git a/Library/Formula/djvulibre.rb b/Library/Formula/djvulibre.rb index 641940079..e6c1f9f7b 100644 --- a/Library/Formula/djvulibre.rb +++ b/Library/Formula/djvulibre.rb @@ -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 diff --git a/Library/Formula/dockutil.rb b/Library/Formula/dockutil.rb index efa7cb0b6..4279a1757 100644 --- a/Library/Formula/dockutil.rb +++ b/Library/Formula/dockutil.rb @@ -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 diff --git a/Library/Formula/elinks.rb b/Library/Formula/elinks.rb index c161935b2..7ad6d4f44 100644 --- a/Library/Formula/elinks.rb +++ b/Library/Formula/elinks.rb @@ -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 diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb index 59d9736a9..08992a3f1 100644 --- a/Library/Formula/emacs.rb +++ b/Library/Formula/emacs.rb @@ -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 diff --git a/Library/Formula/enscript.rb b/Library/Formula/enscript.rb index 10edb4844..78f45d703 100644 --- a/Library/Formula/enscript.rb +++ b/Library/Formula/enscript.rb @@ -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 diff --git a/Library/Formula/fakeroot.rb b/Library/Formula/fakeroot.rb index 535fdec45..fecde7ed0 100644 --- a/Library/Formula/fakeroot.rb +++ b/Library/Formula/fakeroot.rb @@ -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 diff --git a/Library/Formula/fdupes.rb b/Library/Formula/fdupes.rb index ac9824c7c..80a26d909 100644 --- a/Library/Formula/fdupes.rb +++ b/Library/Formula/fdupes.rb @@ -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 diff --git a/Library/Formula/fzf.rb b/Library/Formula/fzf.rb index 923804073..8095384ad 100644 --- a/Library/Formula/fzf.rb +++ b/Library/Formula/fzf.rb @@ -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 diff --git a/Library/Formula/gawk.rb b/Library/Formula/gawk.rb index acef41b5d..8c01a7d37 100644 --- a/Library/Formula/gawk.rb +++ b/Library/Formula/gawk.rb @@ -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 diff --git a/Library/Formula/git-tracker.rb b/Library/Formula/git-tracker.rb index 347f82c17..27ebd78d2 100644 --- a/Library/Formula/git-tracker.rb +++ b/Library/Formula/git-tracker.rb @@ -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 diff --git a/Library/Formula/gptfdisk.rb b/Library/Formula/gptfdisk.rb index f057abaf0..7d5102d8c 100644 --- a/Library/Formula/gptfdisk.rb +++ b/Library/Formula/gptfdisk.rb @@ -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 diff --git a/Library/Formula/htmlcleaner.rb b/Library/Formula/htmlcleaner.rb index 5e7843611..3b5f1a933 100644 --- a/Library/Formula/htmlcleaner.rb +++ b/Library/Formula/htmlcleaner.rb @@ -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 diff --git a/Library/Formula/hub.rb b/Library/Formula/hub.rb index d49a21f14..9dd1b7de1 100644 --- a/Library/Formula/hub.rb +++ b/Library/Formula/hub.rb @@ -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 diff --git a/Library/Formula/iozone.rb b/Library/Formula/iozone.rb index 86e1fe21e..0b9531524 100644 --- a/Library/Formula/iozone.rb +++ b/Library/Formula/iozone.rb @@ -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 diff --git a/Library/Formula/javarepl.rb b/Library/Formula/javarepl.rb index ade15fbde..bf8012cbd 100644 --- a/Library/Formula/javarepl.rb +++ b/Library/Formula/javarepl.rb @@ -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 diff --git a/Library/Formula/jq.rb b/Library/Formula/jq.rb index 3eb3566aa..860b2c465 100644 --- a/Library/Formula/jq.rb +++ b/Library/Formula/jq.rb @@ -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 diff --git a/Library/Formula/jshon.rb b/Library/Formula/jshon.rb index 75b3957c1..b360c66c0 100644 --- a/Library/Formula/jshon.rb +++ b/Library/Formula/jshon.rb @@ -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 diff --git a/Library/Formula/jslint4java.rb b/Library/Formula/jslint4java.rb index aca3d8b3d..92cbf3d18 100644 --- a/Library/Formula/jslint4java.rb +++ b/Library/Formula/jslint4java.rb @@ -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 diff --git a/Library/Formula/jsmin.rb b/Library/Formula/jsmin.rb index 137c79ff6..3a16ea44d 100644 --- a/Library/Formula/jsmin.rb +++ b/Library/Formula/jsmin.rb @@ -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 diff --git a/Library/Formula/jsonpp.rb b/Library/Formula/jsonpp.rb index 4cdbf632d..0c00153fe 100644 --- a/Library/Formula/jsonpp.rb +++ b/Library/Formula/jsonpp.rb @@ -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 diff --git a/Library/Formula/libvbucket.rb b/Library/Formula/libvbucket.rb index 4ca8624f5..c747d6579 100644 --- a/Library/Formula/libvbucket.rb +++ b/Library/Formula/libvbucket.rb @@ -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 diff --git a/Library/Formula/lorem.rb b/Library/Formula/lorem.rb index c8ac13ef8..6ae92f87c 100644 --- a/Library/Formula/lorem.rb +++ b/Library/Formula/lorem.rb @@ -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 diff --git a/Library/Formula/markdown.rb b/Library/Formula/markdown.rb index 032eefcfc..3f9c1aee5 100644 --- a/Library/Formula/markdown.rb +++ b/Library/Formula/markdown.rb @@ -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 diff --git a/Library/Formula/mp3fs.rb b/Library/Formula/mp3fs.rb index 03ac8bb14..012ac669c 100644 --- a/Library/Formula/mp3fs.rb +++ b/Library/Formula/mp3fs.rb @@ -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 diff --git a/Library/Formula/msitools.rb b/Library/Formula/msitools.rb index b9afc9973..b090a2a08 100644 --- a/Library/Formula/msitools.rb +++ b/Library/Formula/msitools.rb @@ -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| diff --git a/Library/Formula/multimarkdown.rb b/Library/Formula/multimarkdown.rb index fc9bb23eb..0fc5da1a3 100644 --- a/Library/Formula/multimarkdown.rb +++ b/Library/Formula/multimarkdown.rb @@ -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 diff --git a/Library/Formula/newick-utils.rb b/Library/Formula/newick-utils.rb index 93d5a3277..6bc895413 100644 --- a/Library/Formula/newick-utils.rb +++ b/Library/Formula/newick-utils.rb @@ -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 diff --git a/Library/Formula/newlisp.rb b/Library/Formula/newlisp.rb index 829c1941d..1898e8e30 100644 --- a/Library/Formula/newlisp.rb +++ b/Library/Formula/newlisp.rb @@ -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 diff --git a/Library/Formula/nodebrew.rb b/Library/Formula/nodebrew.rb index b65244fc2..ae292fc5d 100644 --- a/Library/Formula/nodebrew.rb +++ b/Library/Formula/nodebrew.rb @@ -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 diff --git a/Library/Formula/phantomjs.rb b/Library/Formula/phantomjs.rb index 4798f85f0..0fe2cf863 100644 --- a/Library/Formula/phantomjs.rb +++ b/Library/Formula/phantomjs.rb @@ -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 diff --git a/Library/Formula/picolisp.rb b/Library/Formula/picolisp.rb index bcb04278b..bc5934354 100644 --- a/Library/Formula/picolisp.rb +++ b/Library/Formula/picolisp.rb @@ -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 diff --git a/Library/Formula/pidcat.rb b/Library/Formula/pidcat.rb index 976c88dbc..8c3c47167 100644 --- a/Library/Formula/pidcat.rb +++ b/Library/Formula/pidcat.rb @@ -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 diff --git a/Library/Formula/pike.rb b/Library/Formula/pike.rb index db645e19a..3dcd8a611 100644 --- a/Library/Formula/pike.rb +++ b/Library/Formula/pike.rb @@ -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 diff --git a/Library/Formula/q.rb b/Library/Formula/q.rb index 3d73c60f7..95210f256 100644 --- a/Library/Formula/q.rb +++ b/Library/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 diff --git a/Library/Formula/scala.rb b/Library/Formula/scala.rb index 0db1b0d29..3a225d8ac 100644 --- a/Library/Formula/scala.rb +++ b/Library/Formula/scala.rb @@ -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 diff --git a/Library/Formula/spidermonkey.rb b/Library/Formula/spidermonkey.rb index 9f5649ef2..50f8aaf9c 100644 --- a/Library/Formula/spidermonkey.rb +++ b/Library/Formula/spidermonkey.rb @@ -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 diff --git a/Library/Formula/tpp.rb b/Library/Formula/tpp.rb index d0c934186..d6ef484dd 100644 --- a/Library/Formula/tpp.rb +++ b/Library/Formula/tpp.rb @@ -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 diff --git a/Library/Formula/ucspi-tcp.rb b/Library/Formula/ucspi-tcp.rb index da49a6a56..14eb1ae15 100644 --- a/Library/Formula/ucspi-tcp.rb +++ b/Library/Formula/ucspi-tcp.rb @@ -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 diff --git a/Library/Formula/udis86.rb b/Library/Formula/udis86.rb index 189947527..76680e4e3 100644 --- a/Library/Formula/udis86.rb +++ b/Library/Formula/udis86.rb @@ -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 diff --git a/Library/Formula/unac.rb b/Library/Formula/unac.rb index 02a56883b..5e820ef02 100644 --- a/Library/Formula/unac.rb +++ b/Library/Formula/unac.rb @@ -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 diff --git a/Library/Formula/vala.rb b/Library/Formula/vala.rb index 8105fb79e..93dd279ec 100644 --- a/Library/Formula/vala.rb +++ b/Library/Formula/vala.rb @@ -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 diff --git a/Library/Formula/vera++.rb b/Library/Formula/vera++.rb index 4706c9ca0..97462ae56 100644 --- a/Library/Formula/vera++.rb +++ b/Library/Formula/vera++.rb @@ -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 diff --git a/Library/Formula/wdiff.rb b/Library/Formula/wdiff.rb index 413a836da..040531be2 100644 --- a/Library/Formula/wdiff.rb +++ b/Library/Formula/wdiff.rb @@ -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 diff --git a/Library/Formula/wireshark.rb b/Library/Formula/wireshark.rb index 36092bbf9..e1e91b164 100644 --- a/Library/Formula/wireshark.rb +++ b/Library/Formula/wireshark.rb @@ -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 diff --git a/Library/Formula/xmlsh.rb b/Library/Formula/xmlsh.rb index caf16792d..5134b87a1 100644 --- a/Library/Formula/xmlsh.rb +++ b/Library/Formula/xmlsh.rb @@ -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 diff --git a/Library/Formula/yajl.rb b/Library/Formula/yajl.rb index b8fcee65d..d88b3d67e 100644 --- a/Library/Formula/yajl.rb +++ b/Library/Formula/yajl.rb @@ -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 diff --git a/Library/Formula/yara.rb b/Library/Formula/yara.rb index cb04a97d3..943fa0a51 100644 --- a/Library/Formula/yara.rb +++ b/Library/Formula/yara.rb @@ -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 diff --git a/Library/Formula/yle-dl.rb b/Library/Formula/yle-dl.rb index 9379a73ed..39c67f962 100644 --- a/Library/Formula/yle-dl.rb +++ b/Library/Formula/yle-dl.rb @@ -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 diff --git a/Library/Formula/z80dasm.rb b/Library/Formula/z80dasm.rb index b08455260..1392b8657 100644 --- a/Library/Formula/z80dasm.rb +++ b/Library/Formula/z80dasm.rb @@ -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 diff --git a/Library/Formula/zxcc.rb b/Library/Formula/zxcc.rb index 446a3dc9d..b733e5654 100644 --- a/Library/Formula/zxcc.rb +++ b/Library/Formula/zxcc.rb @@ -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 | 
