From 42080a3c95e7c6b876b50203cbb1d60149331264 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 30 Oct 2021 16:08:42 +0200 Subject: [PATCH] Update for newer base libraries, improves error messages. --- CMakeLists.txt | 1 - CMakeLists.txt.in | 2 ++ src/Precompiled.hxx | 6 ------ src/Tester/AngelScript/MiscMockFunctions.hpp | 2 +- src/Tester/Test.hpp | 8 +++++++- 5 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 src/Precompiled.hxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 897d9e1..7341e8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,6 @@ endif () file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp extern/AngelscriptDebugger/src/*.cpp) add_executable(PokemonScriptTester ${SRC_FILES}) -target_precompile_headers(PokemonScriptTester PUBLIC src/Precompiled.hxx) add_definitions(-DLEVEL_U8) SET(_LINKS -static pkmnLib) diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index 0865b4e..7efe8c8 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -40,6 +40,8 @@ function(include_pkmnlib) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include) execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/src ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib) + execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern + ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/extern) execute_process(COMMAND cp -r ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib/extern) diff --git a/src/Precompiled.hxx b/src/Precompiled.hxx deleted file mode 100644 index 51fa8c7..0000000 --- a/src/Precompiled.hxx +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEMONSCRIPTTESTER_PRECOMPILED_HXX -#define POKEMONSCRIPTTESTER_PRECOMPILED_HXX - -#include - -#endif // POKEMONSCRIPTTESTER_PRECOMPILED_HXX diff --git a/src/Tester/AngelScript/MiscMockFunctions.hpp b/src/Tester/AngelScript/MiscMockFunctions.hpp index 1d00349..ec1c8fa 100644 --- a/src/Tester/AngelScript/MiscMockFunctions.hpp +++ b/src/Tester/AngelScript/MiscMockFunctions.hpp @@ -25,7 +25,7 @@ class MiscMockFunctions { auto move = Globals::Library.GetValue()->GetMoveLibrary()->TryGet(moveName); if (!move.has_value()) { - return {}; + THROW("Unknown move: " << moveName); } auto learnedMove = new PkmnLib::Battling::LearnedMove(move.value(), CreatureLib::Battling::AttackLearnMethod::Unknown); diff --git a/src/Tester/Test.hpp b/src/Tester/Test.hpp index b3e98a4..0eee723 100644 --- a/src/Tester/Test.hpp +++ b/src/Tester/Test.hpp @@ -26,7 +26,13 @@ public: _env->CollectGarbage(); if (e == asEXECUTION_EXCEPTION) { - _errorMessage = ctx->GetExceptionString(); + std::stringstream error; + const char* exceptionSection = ""; + int exceptionColumn = 0; + auto exceptionLine = ctx->GetExceptionLineNumber(&exceptionColumn, &exceptionSection); + error << "[" << exceptionSection << ":" << exceptionLine << "," << exceptionColumn << "] " + << ctx->GetExceptionString(); + _errorMessage = error.str(); _result = TestResult::Failed; ctx->PopState(); return;