mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
added test cases for noexcept functions
All pass in C++14, broken in C++17
This commit is contained in:
parent
4f959c9a41
commit
db39b2f316
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user