mirror of
https://github.com/pantor/inja.git
synced 2026-05-15 17:05:23 +00:00
Initialize missing fields in Lexer constructor (#304)
* Initialize missing fields in Lexer constructor - Add tok_start and pos initialization to Lexer constructor - Fix clang-tidy uninitialized fields warning Signed-off-by: Huang Rui <vowstar@gmail.com> * Fix argument type mismatch for load_file and load_json methods - Use .string() method for path objects in benchmark file loading - Apply same path conversion in test cases for consistency Signed-off-by: Huang Rui <vowstar@gmail.com> * Fix and cleanup mismatch error in windows test case - Use .string() method for path objects in benchmark file loading - Fix test case failure introduced in https://github.com/pantor/inja/commit/65aa8a669dfa1d7aae4aed457cbf8834f33ad419 Signed-off-by: Huang Rui <vowstar@gmail.com> --------- Signed-off-by: Huang Rui <vowstar@gmail.com>
This commit is contained in:
+3
-3
@@ -10,7 +10,7 @@ TEST_CASE("loading") {
|
||||
data["name"] = "Jeff";
|
||||
|
||||
SUBCASE("Files should be loaded") {
|
||||
CHECK(env.load_file(test_file_directory / "simple.txt") == "Hello {{ name }}.");
|
||||
CHECK(env.load_file((test_file_directory / "simple.txt").string()) == "Hello {{ name }}.");
|
||||
}
|
||||
|
||||
SUBCASE("Files should be rendered") {
|
||||
@@ -22,7 +22,7 @@ TEST_CASE("loading") {
|
||||
}
|
||||
|
||||
SUBCASE("File error should throw") {
|
||||
std::string path(test_file_directory / "does-not-exist");
|
||||
std::string path = (test_file_directory / "does-not-exist").string();
|
||||
|
||||
std::string file_error_message = "[inja.exception.file_error] failed accessing file at '" + path + "'";
|
||||
CHECK_THROWS_WITH(env.load_file(path), file_error_message.c_str());
|
||||
@@ -98,7 +98,7 @@ TEST_CASE("include-in-memory-and-file-template") {
|
||||
inja::json data;
|
||||
data["name"] = "Jeff";
|
||||
|
||||
std::string error_message = "[inja.exception.file_error] failed accessing file at '" + test_file_directory.string() + "/body'";
|
||||
std::string error_message = "[inja.exception.file_error] failed accessing file at '" + (test_file_directory / "body").string() + "'";
|
||||
CHECK_THROWS_WITH(env.render_file("include-both.txt", data), error_message.c_str());
|
||||
|
||||
const auto parsed_body_template = env.parse("Bye {{ name }}.");
|
||||
|
||||
Reference in New Issue
Block a user