Fix formatting on tests file

This commit is contained in:
Rapptz 2014-04-27 01:18:54 -04:00
parent 63bc2b06cb
commit b6c2f1c6d5

View File

@ -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 {
int x;
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 ) {
return x + y + 2;
}
};
struct fuser {
int x;
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) {
return x + y + 2;
}
};
}
int plop_xyz(int x, int y, std::string z) {
@ -368,11 +359,11 @@ 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"
"c = a:add2(1)\n");
"b = a:add(1)\n"
"c = a:add2(1)\n");
sol::object a = lua.get<sol::object>("a");
sol::object b = lua.get<sol::object>("b");
@ -399,16 +390,15 @@ TEST_CASE("tables/userdata constructors", "Show that we can create classes from
lua.set_class(lc);
lua.script(
"a = crapola_fuser.new(2)\n"
"u = a:add(1)\n"
"v = a:add2(1)\n"
"b = crapola_fuser:new()\n"
"w = b:add(1)\n"
"x = b:add2(1)\n"
"c = crapola_fuser.new(2, 3)\n"
"y = c:add(1)\n"
"z = c:add2(1)\n"
);
"a = crapola_fuser.new(2)\n"
"u = a:add(1)\n"
"v = a:add2(1)\n"
"b = crapola_fuser:new()\n"
"w = b:add(1)\n"
"x = b:add2(1)\n"
"c = crapola_fuser.new(2, 3)\n"
"y = c:add(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));