diff options
| author | Tim D. Smith | 2014-12-21 16:38:17 -0500 |
|---|---|---|
| committer | Tim D. Smith | 2014-12-22 21:03:35 -0500 |
| commit | 11903f965101417b1467e24151a297006d3f2523 (patch) | |
| tree | 2ddefcd4afea52a38ed349b25b0f31f80e70c666 /Library | |
| parent | 2c8336cf6506f7815ae4ccb0a44b63a22849041b (diff) | |
| download | homebrew-11903f965101417b1467e24151a297006d3f2523.tar.bz2 | |
luabind: add test
Closes #35171.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/luabind.rb | 24 |
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 |
