mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
some utility changes because of the way variants are checked now...
This commit is contained in:
parent
eb6f425245
commit
e440d7a79b
|
@ -71,11 +71,11 @@ TEST_CASE("utility/variant", "test that variant can be round-tripped") {
|
||||||
lua.set_function("f", [](int v) {
|
lua.set_function("f", [](int v) {
|
||||||
return v == 2;
|
return v == 2;
|
||||||
});
|
});
|
||||||
lua.set_function("g", [](std::variant<float, int, std::string> vv) {
|
lua.set_function("g", [](std::variant<int, float, std::string> vv) {
|
||||||
int v = std::get<int>(vv);
|
int v = std::get<int>(vv);
|
||||||
return v == 2;
|
return v == 2;
|
||||||
});
|
});
|
||||||
lua["v"] = std::variant<float, int, std::string>(2);
|
lua["v"] = std::variant<int, float, std::string>(2);
|
||||||
{
|
{
|
||||||
auto result = lua.safe_script("assert(f(v))", sol::script_pass_on_error);
|
auto result = lua.safe_script("assert(f(v))", sol::script_pass_on_error);
|
||||||
REQUIRE(result.valid());
|
REQUIRE(result.valid());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user