diff options
| author | Xu Cheng | 2015-01-03 16:03:50 +0800 |
|---|---|---|
| committer | Jack Nagel | 2015-01-03 21:39:47 -0500 |
| commit | 0a6ea49bc1304588f6317553e7a9be4a81aec3c8 (patch) | |
| tree | 69b7cd84a5914db4961868e83ee053a21fad1fba /Library/Formula | |
| parent | 51353e51067bd9c7a1e0d10393bedcd6d861d8f7 (diff) | |
| download | homebrew-0a6ea49bc1304588f6317553e7a9be4a81aec3c8.tar.bz2 | |
swig: add test
Closes #35493.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/swig.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Library/Formula/swig.rb b/Library/Formula/swig.rb index 5014f4ae5..f273fc293 100644 --- a/Library/Formula/swig.rb +++ b/Library/Formula/swig.rb @@ -1,5 +1,3 @@ -require "formula" - class Swig < Formula homepage "http://www.swig.org/" url "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.2/swig-3.0.2.tar.gz" @@ -21,6 +19,30 @@ class Swig < Formula system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make" - system "make install" + system "make", "install" + end + + test do + (testpath/"test.c").write <<-EOS.undent + int add(int x, int y) + { + return x + y; + } + EOS + (testpath/"test.i").write <<-EOS.undent + %module test + %inline %{ + extern int add(int x, int y); + %} + EOS + (testpath/"run.rb").write <<-EOS.undent + require "./test" + puts Test.add(1, 1) + EOS + system "#{bin}/swig", "-ruby", "test.i" + system ENV.cc, "-c", "test.c" + system ENV.cc, "-c", "test_wrap.c", "-I/System/Library/Frameworks/Ruby.framework/Headers/" + system ENV.cc, "-bundle", "-flat_namespace", "-undefined", "suppress", "test.o", "test_wrap.o", "-o", "test.bundle" + assert_equal "2", shell_output("ruby run.rb").strip end end |
