Skip to content

Commit

Permalink
add test for out_value_policy
Browse files Browse the repository at this point in the history
The test is currently broken and reveals a bug in Luabind.
  • Loading branch information
fhoefling committed Nov 24, 2014
1 parent 62bfe95 commit a1199b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ set(TESTS
null_pointer
object
operators
out_value
package_preload
policies
private_destructors
Expand Down
23 changes: 23 additions & 0 deletions test/test_out_value.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "test.hpp"

#include <luabind/luabind.hpp>
#include <luabind/out_value_policy.hpp>

void f(float& val) { val = val + 10.f; }

void test_main(lua_State* L)
{
using namespace luabind;

module(L)
[
def("f", &f, out_value(_1)) // compiles with "pure_out_value"
];

// out_value
DOSTRING(L,
"a = f(5)\n"
"assert(a == 15)");

}

0 comments on commit a1199b5

Please sign in to comment.