added test cases for noexcept functions

All pass in C++14, broken in C++17
This commit is contained in:
Rohlem 2017-06-14 19:24:13 +02:00 committed by The Phantom Derpstorm
parent 4f959c9a41
commit db39b2f316
2 changed files with 18 additions and 0 deletions

View File

@ -99,6 +99,9 @@ struct fer {
}
};
inline void noexcept_function() noexcept {}
struct type_with_noexcept_method{ void noexcept_method() noexcept {} };
TEST_CASE("functions/tuple-returns", "Make sure tuple returns are ordered properly") {
sol::state lua;
lua.script("function f() return '3', 4 end");
@ -1222,3 +1225,10 @@ TEST_CASE("functions/unique-overloading", "make sure overloading can work with p
}());
};
}
TEST_CASE("functions/noexcept", "allow noexcept free - and member functions in Lua") {
sol::state lua;
lua.set_function("noexcept_function", &noexcept_function);
lua.set_function("noexcept_member_function", &type_with_noexcept_method::noexcept_method);
}

View File

@ -265,6 +265,9 @@ struct matrix_xi {
}
};
inline void noexcept_function() noexcept {}
struct type_with_noexcept_method{ void noexcept_method() noexcept {} };
TEST_CASE("usertype/usertype", "Show that we can create classes from usertype and use them") {
sol::state lua;
@ -1809,3 +1812,8 @@ TEST_CASE("usertype/meta-key-retrievals", "allow for special meta keys (__index,
REQUIRE(keys[3] == "__call");
}
}
TEST_CASE("usertype/noexcept-methods", "make sure noexcept functinos and methods can be bound to usertypes without issues") {
sol::state lua;
lua.new_usertype<type_with_noexcept_method>("tmp", "nf", &noexcept_function, "nm", &type_with_noexcept_method::noexcept_method);
}