tests: Fixed build with new pattern language changes

This commit is contained in:
Nik
2023-06-05 10:03:55 +02:00
committed by GitHub
parent 062edfe527
commit 92e61ccf5d
2 changed files with 22 additions and 21 deletions

View File

@@ -52,16 +52,8 @@ int main(int argc, char **argv) {
runtime.setIncludePaths({ includePath });
runtime.addPragma("MIME", DummyPragmaHandler);
runtime.addDefine("__PL_UNIT_TESTS__");
}
// Execute pattern
if (!runtime.executeString(patternFile.readString())) {
fmt::print("Error during execution!\n");
if (const auto &hardError = runtime.getError(); hardError.has_value())
fmt::print("Hard error: {}:{} - {}\n\n", hardError->line, hardError->column, hardError->message);
for (const auto &[level, message] : runtime.getConsoleLog()) {
runtime.setLogCallback([](auto level, const std::string &message) {
switch (level) {
using enum pl::core::LogConsole::Level;
case Debug: fmt::print(" [DEBUG] "); break;
@@ -71,7 +63,16 @@ int main(int argc, char **argv) {
}
fmt::print("{}\n", message);
}
});
}
// Execute pattern
if (!runtime.executeString(patternFile.readString())) {
fmt::print("Error during execution!\n");
if (const auto &hardError = runtime.getError(); hardError.has_value())
fmt::print("Hard error: {}:{} - {}\n\n", hardError->line, hardError->column, hardError->message);
return EXIT_FAILURE;
}