From 4918be8b47bec88da4328909f8da236fbc988a54 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 26 Mar 2013 11:24:42 -0500 Subject: newick-utils: improve test --- Library/Formula/newick-utils.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'Library/Formula') 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 -- cgit v1.2.3