Skip to content

Commit

Permalink
newick-utils: improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Mar 26, 2013
1 parent 1ac1c66 commit 053ae7e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Formula/newick-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,24 @@ def install
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

Expand Down

0 comments on commit 053ae7e

Please sign in to comment.