aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorJack Nagel2013-03-26 11:24:42 -0500
committerJack Nagel2013-03-26 12:58:47 -0500
commit4918be8b47bec88da4328909f8da236fbc988a54 (patch)
tree8914d2ac72fe0e30e3c6a568ebdb56bb1af21085 /Library/Formula
parent25b500240ce52f2112adfcbdc7daa57f57133996 (diff)
downloadhomebrew-4918be8b47bec88da4328909f8da236fbc988a54.tar.bz2
newick-utils: improve test
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/newick-utils.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/Library/Formula/newick-utils.rb b/Library/Formula/newick-utils.rb
index d201990ad..82df8e114 100644
--- a/Library/Formula/newick-utils.rb
+++ b/Library/Formula/newick-utils.rb
@@ -18,8 +18,24 @@ class NewickUtils < Formula
system "make install"
end
- def test
- system "echo '(B:1,C:2)A;' | #{bin}/nw_display -"
+ test do
+ require 'open3'
+
+ expected = <<-EOS
+ +-------------------------------------+ B
+=| A
+ +---------------------------------------------------------------------------+ C
+
+ |------------------|------------------|------------------|------------------|
+ 0 0.5 1 1.5 2
+ substitutions/site
+EOS
+
+ Open3.popen3("#{bin}/nw_display", "-") do |stdin, stdout, _|
+ stdin.write("(B:1,C:2)A;\n")
+ stdin.close
+ expected == stdout.read.split("\n").map(&:rstrip).join("\n")
+ end
end
end