xtail: fix test (#5481)

This commit is contained in:
Zhiming Wang 2016-10-03 08:47:14 -04:00 committed by GitHub
parent df479bc724
commit a12b90c745

View file

@ -22,6 +22,26 @@ class Xtail < Formula
end
test do
system "#{bin}/xtail"
file1 = testpath/"file1"
file2 = testpath/"file2"
touch file1
touch file2
begin
p = IO.popen("#{bin}/xtail file1 file2")
# Give xtail a couple seconds before and after so that it could
# relatively reliably pick up the changes.
sleep 2
file1.append_lines "hello\n"
file2.append_lines "world\n"
sleep 2
ensure
Process.kill "QUIT", p.pid
Process.wait p.pid
end
output = p.read
assert_match "hello", output
assert_match "world", output
end
end