29 lines
871 B
C++
29 lines
871 B
C++
#include "TemplatingEngine.h"
|
|
#include "TemplateSubstitutionContext.h"
|
|
|
|
#include "File.h"
|
|
|
|
#include "TestFramework.h"
|
|
#include "TestUtils.h"
|
|
|
|
TEST_CASE(TestTemplatingEngine_BlockInherit, "compiler")
|
|
{
|
|
auto engine = TemplatingEngine(TestUtils::getTestDataDir());
|
|
const auto content = engine.renderTemplate("index", nullptr);
|
|
|
|
File outfile(TestUtils::getTestOutputDir(__FILE__) / "BlockInherit.html");
|
|
outfile.writeText(content);
|
|
}
|
|
|
|
TEST_CASE(TestTemplatingEngine_Simple, "compiler")
|
|
{
|
|
auto engine = TemplatingEngine(TestUtils::getTestDataDir());
|
|
|
|
TemplateSubstitutionContext sub_context;
|
|
sub_context.addSubstitution("content", "<div><p>test</p></div>");
|
|
|
|
const auto content = engine.renderTemplate("simple_template", &sub_context);
|
|
|
|
File outfile(TestUtils::getTestOutputDir(__FILE__) / "Simple.html");
|
|
outfile.writeText(content);
|
|
}
|