mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix formatting on tests file
This commit is contained in:
parent
63bc2b06cb
commit
b6c2f1c6d5
38
tests.cpp
38
tests.cpp
|
@ -8,50 +8,41 @@ std::string free_function() {
|
|||
}
|
||||
|
||||
struct object {
|
||||
|
||||
std::string operator() () {
|
||||
std::cout << "member_test()" << std::endl;
|
||||
return "test";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct fuser {
|
||||
int x;
|
||||
fuser() : x(0) {}
|
||||
|
||||
fuser( ) : x( 0 ) {
|
||||
fuser(int x) : x(x) {}
|
||||
|
||||
}
|
||||
|
||||
fuser( int x ) : x( x ) {
|
||||
|
||||
}
|
||||
|
||||
int add( int y ) {
|
||||
int add(int y) {
|
||||
return x + y;
|
||||
}
|
||||
|
||||
int add2( int y ) {
|
||||
int add2(int y) {
|
||||
return x + y + 2;
|
||||
}
|
||||
};
|
||||
|
||||
namespace crapola {
|
||||
struct fuser {
|
||||
struct fuser {
|
||||
int x;
|
||||
fuser( ) : x( 0 ) {
|
||||
}
|
||||
fuser( int x ) : x( x ) {
|
||||
}
|
||||
fuser( int x, int x2 ) : x( x * x2 ) {
|
||||
}
|
||||
int add( int y ) {
|
||||
fuser() : x(0) {}
|
||||
fuser(int x) : x(x) {}
|
||||
fuser(int x, int x2) : x(x * x2) {}
|
||||
|
||||
int add(int y) {
|
||||
return x + y;
|
||||
}
|
||||
int add2( int y ) {
|
||||
int add2(int y) {
|
||||
return x + y + 2;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
int plop_xyz(int x, int y, std::string z) {
|
||||
|
@ -368,7 +359,7 @@ TEST_CASE("tables/userdata", "Show that we can create classes from userdata and
|
|||
sol::state lua;
|
||||
|
||||
sol::userdata<fuser> lc{ &fuser::add, "add", &fuser::add2, "add2" };
|
||||
lua.set_class( lc );
|
||||
lua.set_class(lc);
|
||||
|
||||
lua.script("a = fuser:new()\n"
|
||||
"b = a:add(1)\n"
|
||||
|
@ -407,8 +398,7 @@ TEST_CASE("tables/userdata constructors", "Show that we can create classes from
|
|||
"x = b:add2(1)\n"
|
||||
"c = crapola_fuser.new(2, 3)\n"
|
||||
"y = c:add(1)\n"
|
||||
"z = c:add2(1)\n"
|
||||
);
|
||||
"z = c:add2(1)\n");
|
||||
sol::object a = lua.get<sol::object>("a");
|
||||
auto atype = a.get_type();
|
||||
REQUIRE((atype == sol::type::userdata));
|
||||
|
|
Loading…
Reference in New Issue
Block a user