mirror of
https://github.com/pantor/inja.git
synced 2026-04-05 07:38:52 +00:00
fix string view reference movement in bytecode
This commit is contained in:
@@ -5,26 +5,28 @@
|
||||
using json = nlohmann::json;
|
||||
|
||||
|
||||
const std::string test_file_directory {"../test/data/"};
|
||||
|
||||
TEST_CASE("loading") {
|
||||
inja::Environment env = inja::Environment();
|
||||
inja::Environment env;
|
||||
json data;
|
||||
data["name"] = "Jeff";
|
||||
|
||||
SECTION("Files should be loaded") {
|
||||
CHECK( env.load_file("../test/data/simple.txt") == "Hello {{ name }}." );
|
||||
CHECK( env.load_file(test_file_directory + "simple.txt") == "Hello {{ name }}." );
|
||||
}
|
||||
|
||||
SECTION("Files should be rendered") {
|
||||
CHECK( env.render_file("../test/data/simple.txt", data) == "Hello Jeff." );
|
||||
CHECK( env.render_file(test_file_directory + "simple.txt", data) == "Hello Jeff." );
|
||||
}
|
||||
|
||||
SECTION("File includes should be rendered") {
|
||||
CHECK( env.render_file("../test/data/include.txt", data) == "Answer: Hello Jeff." );
|
||||
CHECK( env.render_file(test_file_directory + "include.txt", data) == "Answer: Hello Jeff." );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("complete-files") {
|
||||
inja::Environment env = inja::Environment("../test/data/");
|
||||
inja::Environment env {test_file_directory};
|
||||
|
||||
for (std::string test_name : {"simple-file", "nested", "nested-line", "html"}) {
|
||||
SECTION(test_name) {
|
||||
@@ -34,8 +36,8 @@ TEST_CASE("complete-files") {
|
||||
}
|
||||
|
||||
TEST_CASE("global-path") {
|
||||
inja::Environment env = inja::Environment("../test/data/", "./");
|
||||
inja::Environment env_result = inja::Environment("./");
|
||||
inja::Environment env {test_file_directory, "./"};
|
||||
inja::Environment env_result {"./"};
|
||||
json data;
|
||||
data["name"] = "Jeff";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user