txt2man: test added

Closes Homebrew/homebrew#35817.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Baptiste Fontaine 2015-01-13 11:05:19 +01:00 committed by Mike McQuaid
parent ddf4293013
commit 5a3aaa4e47

View file

@ -1,20 +1,40 @@
require 'formula'
class Txt2man < Formula
homepage 'http://mvertes.free.fr/'
url 'http://mvertes.free.fr/download/txt2man-1.5.6.tar.gz'
sha1 'ef1392785333ea88f7e01f4f4c519ecfbdd498bd'
homepage "http://mvertes.free.fr/"
url "http://mvertes.free.fr/download/txt2man-1.5.6.tar.gz"
sha1 "ef1392785333ea88f7e01f4f4c519ecfbdd498bd"
depends_on 'gawk'
depends_on "gawk"
def install
man1.install %W[bookman.1 src2man.1 txt2man.1]
bin.install %W[bookman src2man txt2man]
man1.install %w[bookman.1 src2man.1 txt2man.1]
bin.install %w[bookman src2man txt2man]
end
test do
system "#{bin}/txt2man", "-h"
system "#{bin}/src2man", "-h"
system "#{bin}/bookman", "-h"
# txt2man
(testpath/"test.txt").write <<-EOS.undent
A TITLE
blah blah blah
EOS
assert_match(/\.SH A TITLE/, shell_output("#{bin}/txt2man test.txt"))
# src2man
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
/** 3
* main - do stuff
**/
int main(void) { return 0; }
EOS
assert_equal "main.3\n", shell_output("#{bin}/src2man test.c 2>&1")
assert File.read("main.3").include?(%q(\fBmain \fP- do stuff))
# bookman
system "#{bin}/bookman", "-t", "Test", "-o", "test", Dir["#{man1}/*"]
assert File.exist?("test")
end
end