diff options
Diffstat (limited to '')
-rw-r--r-- | unit_tests/shared.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/unit_tests/shared.cpp b/unit_tests/shared.cpp index 0825227..d2b4ef7 100644 --- a/unit_tests/shared.cpp +++ b/unit_tests/shared.cpp | |||
@@ -98,7 +98,7 @@ namespace | |||
98 | // ################################################################################################# | 98 | // ################################################################################################# |
99 | // ################################################################################################# | 99 | // ################################################################################################# |
100 | 100 | ||
101 | TEST_CASE("stack checker") | 101 | TEST_CASE("lanes.stack checker") |
102 | { | 102 | { |
103 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; | 103 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; |
104 | StackChecker::CallsCassert = false; | 104 | StackChecker::CallsCassert = false; |
@@ -292,10 +292,10 @@ LuaError LuaState::loadFile(std::filesystem::path const& root_, std::string_view | |||
292 | void LuaState::requireFailure(std::string_view const& script_) | 292 | void LuaState::requireFailure(std::string_view const& script_) |
293 | { | 293 | { |
294 | auto const _result{ doString(script_) }; | 294 | auto const _result{ doString(script_) }; |
295 | REQUIRE(_result != LuaError::OK); | ||
296 | if (_result == LuaError::OK) { | 295 | if (_result == LuaError::OK) { |
297 | INFO(luaG_tostring(L, kIdxTop)); | 296 | WARN(luaG_tostring(L, kIdxTop)); |
298 | } | 297 | } |
298 | REQUIRE(_result != LuaError::OK); | ||
299 | lua_settop(L, 0); | 299 | lua_settop(L, 0); |
300 | } | 300 | } |
301 | 301 | ||
@@ -304,10 +304,10 @@ void LuaState::requireFailure(std::string_view const& script_) | |||
304 | void LuaState::requireNotReturnedString(std::string_view const& script_, std::string_view const& unexpected_) | 304 | void LuaState::requireNotReturnedString(std::string_view const& script_, std::string_view const& unexpected_) |
305 | { | 305 | { |
306 | auto const _result{ doStringAndRet(script_) }; | 306 | auto const _result{ doStringAndRet(script_) }; |
307 | REQUIRE(_result != unexpected_); | ||
308 | if (_result == unexpected_) { | 307 | if (_result == unexpected_) { |
309 | INFO(_result); | 308 | WARN(_result); |
310 | } | 309 | } |
310 | REQUIRE(_result != unexpected_); | ||
311 | lua_settop(L, 0); | 311 | lua_settop(L, 0); |
312 | } | 312 | } |
313 | 313 | ||
@@ -316,10 +316,10 @@ void LuaState::requireNotReturnedString(std::string_view const& script_, std::st | |||
316 | void LuaState::requireReturnedString(std::string_view const& script_, std::string_view const& expected_) | 316 | void LuaState::requireReturnedString(std::string_view const& script_, std::string_view const& expected_) |
317 | { | 317 | { |
318 | auto const _result{ doStringAndRet(script_) }; | 318 | auto const _result{ doStringAndRet(script_) }; |
319 | REQUIRE(_result == expected_); | ||
320 | if (_result != expected_) { | 319 | if (_result != expected_) { |
321 | INFO(_result); | 320 | WARN(_result); |
322 | } | 321 | } |
322 | REQUIRE(_result == expected_); | ||
323 | lua_settop(L, 0); | 323 | lua_settop(L, 0); |
324 | } | 324 | } |
325 | 325 | ||
@@ -328,10 +328,10 @@ void LuaState::requireReturnedString(std::string_view const& script_, std::strin | |||
328 | void LuaState::requireSuccess(std::string_view const& script_) | 328 | void LuaState::requireSuccess(std::string_view const& script_) |
329 | { | 329 | { |
330 | auto const _result{ doString(script_) }; | 330 | auto const _result{ doString(script_) }; |
331 | REQUIRE(_result == LuaError::OK); | ||
332 | if (_result != LuaError::OK) { | 331 | if (_result != LuaError::OK) { |
333 | INFO(luaG_tostring(L, kIdxTop)); | 332 | WARN(luaG_tostring(L, kIdxTop)); |
334 | } | 333 | } |
334 | REQUIRE(_result == LuaError::OK); | ||
335 | lua_settop(L, 0); | 335 | lua_settop(L, 0); |
336 | } | 336 | } |
337 | 337 | ||
@@ -340,10 +340,10 @@ void LuaState::requireSuccess(std::string_view const& script_) | |||
340 | void LuaState::requireSuccess(std::filesystem::path const& root_, std::string_view const& path_) | 340 | void LuaState::requireSuccess(std::filesystem::path const& root_, std::string_view const& path_) |
341 | { | 341 | { |
342 | auto const _result{ doFile(root_, path_) }; | 342 | auto const _result{ doFile(root_, path_) }; |
343 | REQUIRE(_result == LuaError::OK); | ||
344 | if (_result != LuaError::OK) { | 343 | if (_result != LuaError::OK) { |
345 | INFO(luaG_tostring(L, kIdxTop)); | 344 | WARN(luaG_tostring(L, kIdxTop)); |
346 | } | 345 | } |
346 | REQUIRE(_result == LuaError::OK); | ||
347 | lua_settop(L, 0); | 347 | lua_settop(L, 0); |
348 | } | 348 | } |
349 | 349 | ||
@@ -360,7 +360,7 @@ LuaError LuaState::runChunk() const | |||
360 | // ################################################################################################# | 360 | // ################################################################################################# |
361 | // ################################################################################################# | 361 | // ################################################################################################# |
362 | 362 | ||
363 | TEST_CASE("LuaState::doString") | 363 | TEST_CASE("LuaState.doString") |
364 | { | 364 | { |
365 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; | 365 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; |
366 | // if the script fails to load, we should find the error message at the top of the stack | 366 | // if the script fails to load, we should find the error message at the top of the stack |