qi: test added

Closes Homebrew/homebrew#37909.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Baptiste Fontaine 2015-03-20 13:28:15 +01:00 committed by Mike McQuaid
parent 7701b3bb2f
commit 48b3e278c2

View file

@ -1,35 +1,37 @@
require 'formula'
class Qi < Formula
homepage 'http://www.lambdassociates.org/'
url 'http://www.lambdassociates.org/Download/QiII1.07.zip'
sha1 '9170e2667902ada04bae3bf494b9560bc3d58fee'
homepage "http://www.lambdassociates.org/"
url "http://www.lambdassociates.org/Download/QiII1.07.zip"
sha256 "515bb99efa1da3f8d416c370c9d98776d273c593efa241dc243da543118fc521"
option 'SBCL', 'Use SBCL instead of CLISP'
depends_on "sbcl" => :optional
if build.include? 'SBCL'
depends_on 'sbcl'
else
depends_on 'clisp'
deprecated_option "SBCL" => "with-sbcl"
if build.without? "sbcl"
depends_on "clisp"
end
def install
if build.include? 'SBCL'
cd 'Lisp' do
if build.with? "sbcl"
cd "Lisp" do
system "sbcl", "--load", "install.lsp"
end
system "echo \"#!/bin/bash\nsbcl --core #{prefix}/Qi.core $*\" > qi"
prefix.install 'Lisp/Qi.core'
(bin/"qi").write "#!/bin/bash\nsbcl --core #{prefix}/Qi.core $*"
prefix.install "Lisp/Qi.core"
else
cd 'Lisp' do
cd "Lisp" do
system "clisp", "install.lsp"
end
system "echo \"#!/bin/bash\nclisp -M #{prefix}/Qi.mem $*\" > qi"
prefix.install 'Lisp/Qi.mem'
(bin/"qi").write "#!/bin/bash\nclisp -M #{prefix}/Qi.mem $*"
prefix.install "Lisp/Qi.mem"
end
system "chmod 755 qi"
bin.install ['qi']
chmod 0755, bin/"qi"
end
test do
assert_match(/\(0-\) 42/,
pipe_output("#{bin}/qi", "(+ 40 1 1)\n(quit)\n", 0))
end
end