From ff86702dd85eab420f6f58e8dcf8375dae4b22b9 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 4 May 2014 12:12:41 -0700 Subject: use test helpers --- Library/Formula/aamath.rb | 7 ++----- Library/Formula/aardvark_shell_utils.rb | 14 +++----------- Library/Formula/ack.rb | 7 ++----- Library/Formula/aha.rb | 7 ++----- Library/Formula/algol68g.rb | 4 +--- Library/Formula/align.rb | 6 +----- Library/Formula/ansifilter.rb | 4 +--- Library/Formula/ascii.rb | 4 +--- Library/Formula/ats2-postiats.rb | 4 +--- Library/Formula/autopano-sift-c.rb | 4 ++-- Library/Formula/avian.rb | 2 +- Library/Formula/avra.rb | 3 +-- Library/Formula/base64.rb | 5 +---- Library/Formula/basex.rb | 5 +---- Library/Formula/bash.rb | 4 +--- Library/Formula/bgrep.rb | 10 ++++------ Library/Formula/calc.rb | 4 +--- Library/Formula/cayley.rb | 15 +++------------ Library/Formula/cbmbasic.rb | 6 +----- Library/Formula/ccal.rb | 3 +-- Library/Formula/cdecl.rb | 5 ++--- Library/Formula/check_postgres.rb | 3 +-- Library/Formula/chicken.rb | 4 +--- Library/Formula/chkrootkit.rb | 3 ++- Library/Formula/cksfv.rb | 4 +--- Library/Formula/cloog.rb | 8 ++------ Library/Formula/cowsay.rb | 3 +-- Library/Formula/cpmtools.rb | 3 +-- Library/Formula/css-crush.rb | 4 +--- Library/Formula/csv-fix.rb | 7 ++----- Library/Formula/csvprintf.rb | 7 ++----- Library/Formula/dart.rb | 2 +- Library/Formula/dasm.rb | 2 +- Library/Formula/ddate.rb | 5 ++--- Library/Formula/disktype.rb | 6 ++---- Library/Formula/djvulibre.rb | 3 ++- Library/Formula/dockutil.rb | 2 +- Library/Formula/elinks.rb | 3 ++- Library/Formula/emacs.rb | 4 +--- Library/Formula/enscript.rb | 6 ++---- Library/Formula/fakeroot.rb | 2 +- Library/Formula/fdupes.rb | 3 +-- Library/Formula/fzf.rb | 2 +- Library/Formula/gawk.rb | 13 ++++++------- Library/Formula/git-tracker.rb | 7 ++----- Library/Formula/gptfdisk.rb | 6 ++---- Library/Formula/htmlcleaner.rb | 5 +---- Library/Formula/hub.rb | 2 +- Library/Formula/iozone.rb | 5 +---- Library/Formula/javarepl.rb | 6 +----- Library/Formula/jq.rb | 6 +----- Library/Formula/jshon.rb | 7 +------ Library/Formula/jslint4java.rb | 18 ++++++++---------- Library/Formula/jsmin.rb | 6 +----- Library/Formula/jsonpp.rb | 17 +++++++---------- Library/Formula/libvbucket.rb | 8 ++------ Library/Formula/lorem.rb | 4 +--- Library/Formula/markdown.rb | 6 +----- Library/Formula/mp3fs.rb | 6 ++---- Library/Formula/msitools.rb | 5 +---- Library/Formula/multimarkdown.rb | 6 +----- Library/Formula/newick-utils.rb | 9 ++------- Library/Formula/newlisp.rb | 14 ++++++-------- Library/Formula/nodebrew.rb | 5 +---- Library/Formula/phantomjs.rb | 4 +--- Library/Formula/picolisp.rb | 5 +---- Library/Formula/pidcat.rb | 15 +++++++-------- Library/Formula/pike.rb | 4 +--- Library/Formula/q.rb | 17 +++++++---------- Library/Formula/scala.rb | 4 +--- Library/Formula/spidermonkey.rb | 5 +---- Library/Formula/tpp.rb | 2 +- Library/Formula/ucspi-tcp.rb | 15 +++++++-------- Library/Formula/udis86.rb | 6 +----- Library/Formula/unac.rb | 5 +---- Library/Formula/vala.rb | 4 +--- Library/Formula/vera++.rb | 26 +++++++++++++------------- Library/Formula/wdiff.rb | 5 ++--- Library/Formula/wireshark.rb | 2 +- Library/Formula/xmlsh.rb | 5 ++--- Library/Formula/yajl.rb | 5 ++--- Library/Formula/yara.rb | 4 +--- Library/Formula/yle-dl.rb | 2 +- Library/Formula/z80dasm.rb | 4 +--- Library/Formula/zxcc.rb | 4 +--- 85 files changed, 167 insertions(+), 346 deletions(-) (limited to 'Library/Formula') 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!