newick-utils: improve test

This commit is contained in:
Jack Nagel 2013-03-26 11:24:42 -05:00
parent 1ac1c66f4e
commit 053ae7e259

View file

@ -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