Make sure nil_t is still available, even if nil is defined.

One day, there'll be a time when I get nearly everything right
This commit is contained in:
ThePhD 2017-09-22 11:04:46 -04:00
parent 0114882e13
commit 290a67134a
5 changed files with 11 additions and 11 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2017-09-22 11:30:13.483049 UTC
// This header was generated with sol v2.18.3 (revision 1b23ad8)
// Generated 2017-09-22 15:04:13.948949 UTC
// This header was generated with sol v2.18.3 (revision 0114882)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -4522,8 +4522,8 @@ namespace sol {
inline bool operator!=(lua_nil_t, lua_nil_t) {
return false;
}
#if !defined(SOL_NO_NIL)
typedef lua_nil_t nil_t;
#if !defined(SOL_NO_NIL)
const nil_t nil{};
#endif

View File

@ -182,8 +182,8 @@ namespace sol {
inline bool operator!=(lua_nil_t, lua_nil_t) {
return false;
}
#if !defined(SOL_NO_NIL)
typedef lua_nil_t nil_t;
#if !defined(SOL_NO_NIL)
const nil_t nil{};
#endif

View File

@ -216,7 +216,7 @@ end )");
REQUIRE_FALSE((bool)testn);
REQUIRE(testv.value() == 29);
sol::optional<thing> v = lua_bark(sol::optional<thing>(thing{ 29 }));
REQUIRE_NOTHROW([&] {sol::nil_t n = lua_bark(sol::nullopt); return n; }());
REQUIRE_NOTHROW([&] {sol::lua_nil_t n = lua_bark(sol::nullopt); return n; }());
REQUIRE(v->v == 29);
}
@ -665,7 +665,7 @@ TEST_CASE("advanced/get and call", "Checks for lambdas returning values after a
REQUIRE_NOTHROW(lua.get<sol::function>("h").call());
REQUIRE_NOTHROW(lua.set_function("i", [] { return sol::lua_nil; }));
REQUIRE(lua.get<sol::function>("i").call<sol::nil_t>() == sol::lua_nil);
REQUIRE(lua.get<sol::function>("i").call<sol::lua_nil_t>() == sol::lua_nil);
REQUIRE_NOTHROW(lua.set_function("j", [] { return std::make_tuple(1, 6.28f, 3.14, std::string("heh")); }));
REQUIRE((lua.get<sol::function>("j").call<int, float, double, std::string>() == heh_tuple));
}
@ -700,7 +700,7 @@ TEST_CASE("advanced/operator[] call", "Checks for lambdas returning values using
REQUIRE_NOTHROW(lua["h"].call());
REQUIRE_NOTHROW(lua.set_function("i", [] { return sol::lua_nil; }));
REQUIRE(lua["i"].call<sol::nil_t>() == sol::lua_nil);
REQUIRE(lua["i"].call<sol::lua_nil_t>() == sol::lua_nil);
REQUIRE_NOTHROW(lua.set_function("j", [] { return std::make_tuple(1, 6.28f, 3.14, std::string("heh")); }));
REQUIRE((lua["j"].call<int, float, double, std::string>() == heh_tuple));
}

View File

@ -184,7 +184,7 @@ TEST_CASE("tables/for_each", "Testing the use of for_each to get values from a l
REQUIRE((value.as<std::string>() == "String value"));
break;
case 3:
REQUIRE((value.is<sol::nil_t>()));
REQUIRE((value.is<sol::lua_nil_t>()));
break;
}
break;
@ -234,7 +234,7 @@ TEST_CASE("tables/for_each empty", "empty tables should not crash") {
REQUIRE((value.as<std::string>() == "String value"));
break;
case 3:
REQUIRE((value.is<sol::nil_t>()));
REQUIRE((value.is<sol::lua_nil_t>()));
break;
}
break;
@ -305,7 +305,7 @@ TEST_CASE("tables/iterators", "Testing the use of iteratrs to get values from a
REQUIRE((value.as<std::string>() == "String value"));
break;
case 3:
REQUIRE((value.is<sol::nil_t>()));
REQUIRE((value.is<sol::lua_nil_t>()));
break;
}
break;

View File

@ -114,7 +114,7 @@ TEST_CASE("simple/get", "Tests if the get function works properly.") {
lua.safe_script("b = nil");
{
test_stack_guard g(lua.lua_state(), begintop, endtop);
REQUIRE_NOTHROW(lua.get<sol::nil_t>("b"));
REQUIRE_NOTHROW(lua.get<sol::lua_nil_t>("b"));
}
REQUIRE(begintop == endtop);