aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
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