mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
filesystem::path fixes
This commit is contained in:
@@ -191,13 +191,13 @@ TEST_CASE("templates") {
|
||||
CHECK_THROWS_WITH(env.parse("{% include \"does-not-exist\" %}!"), "[inja.exception.file_error] failed accessing file at 'does-not-exist'");
|
||||
|
||||
env.set_search_included_templates_in_files(false);
|
||||
env.set_include_callback([&env](const std::string&, const std::string&) { return env.parse("Hello {{ name }}"); });
|
||||
env.set_include_callback([&env](const std::filesystem::path&, const std::string&) { return env.parse("Hello {{ name }}"); });
|
||||
|
||||
const inja::Template t1 = env.parse("{% include \"greeting\" %}!");
|
||||
CHECK(env.render(t1, data) == "Hello Peter!");
|
||||
|
||||
env.set_search_included_templates_in_files(true);
|
||||
env.set_include_callback([&env](const std::string&, const std::string& name) { return env.parse("Bye " + name); });
|
||||
env.set_include_callback([&env](const std::filesystem::path&, const std::string& name) { return env.parse("Bye " + name); });
|
||||
|
||||
const inja::Template t2 = env.parse("{% include \"Jeff\" %}!");
|
||||
CHECK(env.render(t2, data) == "Bye Jeff!");
|
||||
|
||||
Reference in New Issue
Block a user