aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorTim D. Smith2014-12-21 16:38:17 -0500
committerTim D. Smith2014-12-22 21:03:35 -0500
commit11903f965101417b1467e24151a297006d3f2523 (patch)
tree2ddefcd4afea52a38ed349b25b0f31f80e70c666 /Library
parent2c8336cf6506f7815ae4ccb0a44b63a22849041b (diff)
downloadhomebrew-11903f965101417b1467e24151a297006d3f2523.tar.bz2
luabind: add test
Closes #35171.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/luabind.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Formula/luabind.rb b/Library/Formula/luabind.rb
index 00392dab3..15aff1f60 100644
--- a/Library/Formula/luabind.rb
+++ b/Library/Formula/luabind.rb
@@ -53,4 +53,28 @@ class Luabind < Formula
args << "--prefix=#{prefix}"
system "bjam", *args
end
+
+ test do
+ (testpath/"hello.cpp").write <<-EOS.undent
+ extern "C" {
+ #include <lua.h>
+ }
+ #include <iostream>
+ #include <luabind/luabind.hpp>
+ void greet() { std::cout << "hello world!\\n"; }
+ extern "C" int init(lua_State* L)
+ {
+ using namespace luabind;
+ open(L);
+ module(L)
+ [
+ def("greet", &greet)
+ ];
+ return 0;
+ }
+ EOS
+ system ENV.cxx, "-shared", "-o", "hello.dylib", "-I#{HOMEBREW_PREFIX}/include/lua-5.1",
+ testpath/"hello.cpp", "-lluabind", "-llua5.1"
+ assert_match /hello world!/, `lua5.1 -e "package.loadlib('#{testpath}/hello.dylib', 'init')(); greet()"`
+ end
end