Fix: Remove circular dependencies in headers (#295)

* Remove circular dependencies in headers

* Fix unit test includes and test data directory location
This commit is contained in:
Vladislav Navrocky
2025-02-11 11:03:42 +03:00
committed by GitHub
parent 17ba53cb9e
commit 384a6bef3f
17 changed files with 97 additions and 69 deletions

View File

@@ -1,9 +1,8 @@
// Copyright (c) 2020 Pantor. All rights reserved.
#include <doctest/doctest.h>
#include "inja/environment.hpp"
#include "inja/inja.hpp"
#include "test-common.hpp"
TEST_CASE("loading") {
inja::Environment env;
@@ -99,7 +98,8 @@ TEST_CASE("include-in-memory-and-file-template") {
inja::json data;
data["name"] = "Jeff";
CHECK_THROWS_WITH(env.render_file("include-both.txt", data), "[inja.exception.file_error] failed accessing file at '../test/data/body'");
std::string error_message = "[inja.exception.file_error] failed accessing file at '" + test_file_directory + "body'";
CHECK_THROWS_WITH(env.render_file("include-both.txt", data), error_message.c_str());
const auto parsed_body_template = env.parse("Bye {{ name }}.");
env.include_template("body", parsed_body_template);