From d47526a4bcb801501df004bf551d72b050bd374f Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Sat, 27 Aug 2011 13:48:38 -0700 Subject: Asymptote: Add a test The test creates a temporary directory, writes out a simple LaTeX file containing an Asymptote figure, then tries to compile it. --- Library/Formula/asymptote.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Library/Formula') diff --git a/Library/Formula/asymptote.rb b/Library/Formula/asymptote.rb index eacbbbe3a..d10056e0f 100644 --- a/Library/Formula/asymptote.rb +++ b/Library/Formula/asymptote.rb @@ -33,6 +33,34 @@ class Asymptote < Formula system "make install" end + def test + ENV['TEXMFHOME'] = "#{HOMEBREW_PREFIX}/share/texmf" + mktemp do + (Pathname.new(Dir.getwd) + 'asy_test.tex').write <<-EOS.undent + \\nonstopmode + + \\documentclass{minimal} + \\usepackage{asymptote} + + \\begin{document} + Hello, Asymptote! + + \\begin{asy} + size(3cm); + draw((0,0)--(1,0)--(1,1)--(0,1)--cycle); + \\end{asy} + + \\end{document} + EOS + + system "pdflatex asy_test" + system "asy asy_test-1.asy" + system "pdflatex asy_test" + end + + return (not $? == 0) + end + def caveats caveats = <<-EOS 1) This formula links the latest version of the Asymptote LaTeX and ConTeXt -- cgit v1.2.3