From 290a67134a174cefed386259a990b10bce224ffc Mon Sep 17 00:00:00 2001 From: ThePhD Date: Fri, 22 Sep 2017 11:04:46 -0400 Subject: [PATCH] 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 --- single/sol/sol.hpp | 6 +++--- sol/types.hpp | 2 +- tests/test_functions.cpp | 6 +++--- tests/test_tables.cpp | 6 +++--- tests/tests.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index cd2d9c6e..e267952e 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -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 diff --git a/sol/types.hpp b/sol/types.hpp index c407ccc4..79ba94e2 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -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 diff --git a/tests/test_functions.cpp b/tests/test_functions.cpp index d080cc9c..1bcaea58 100644 --- a/tests/test_functions.cpp +++ b/tests/test_functions.cpp @@ -216,7 +216,7 @@ end )"); REQUIRE_FALSE((bool)testn); REQUIRE(testv.value() == 29); sol::optional v = lua_bark(sol::optional(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("h").call()); REQUIRE_NOTHROW(lua.set_function("i", [] { return sol::lua_nil; })); - REQUIRE(lua.get("i").call() == sol::lua_nil); + REQUIRE(lua.get("i").call() == sol::lua_nil); REQUIRE_NOTHROW(lua.set_function("j", [] { return std::make_tuple(1, 6.28f, 3.14, std::string("heh")); })); REQUIRE((lua.get("j").call() == 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::lua_nil); + REQUIRE(lua["i"].call() == 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() == heh_tuple)); } diff --git a/tests/test_tables.cpp b/tests/test_tables.cpp index 5c8445f8..79b2dfe5 100644 --- a/tests/test_tables.cpp +++ b/tests/test_tables.cpp @@ -184,7 +184,7 @@ TEST_CASE("tables/for_each", "Testing the use of for_each to get values from a l REQUIRE((value.as() == "String value")); break; case 3: - REQUIRE((value.is())); + REQUIRE((value.is())); break; } break; @@ -234,7 +234,7 @@ TEST_CASE("tables/for_each empty", "empty tables should not crash") { REQUIRE((value.as() == "String value")); break; case 3: - REQUIRE((value.is())); + REQUIRE((value.is())); break; } break; @@ -305,7 +305,7 @@ TEST_CASE("tables/iterators", "Testing the use of iteratrs to get values from a REQUIRE((value.as() == "String value")); break; case 3: - REQUIRE((value.is())); + REQUIRE((value.is())); break; } break; diff --git a/tests/tests.cpp b/tests/tests.cpp index c7cf1169..fea59f87 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -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("b")); + REQUIRE_NOTHROW(lua.get("b")); } REQUIRE(begintop == endtop);