21#include <QtCore/QDebug>
22#include <QtCore/QFileInfo>
23#include <QtTest/QTest>
25#include "cachingloaderdecorator.h"
27#include "coverageobject.h"
29#include "filterexpression.h"
30#include "cutelee_paths.h"
32#include <metaenumvariable_p.h>
34typedef QHash<QString, QVariant> Dict;
45 void testRenderAfterError();
48void TestCachingLoader::testRenderAfterError()
53 std::shared_ptr<InMemoryTemplateLoader> loader(
new InMemoryTemplateLoader);
54 loader->setTemplate(QStringLiteral(
"template1"),
55 QStringLiteral(
"This template has an error {{ va>r }}"));
56 loader->setTemplate(QStringLiteral(
"template2"), QStringLiteral(
"Ok"));
57 loader->setTemplate(QStringLiteral(
"main"),
58 QStringLiteral(
"{% include template_var %}"));
60 std::shared_ptr<Cutelee::CachingLoaderDecorator> cache(
61 new Cutelee::CachingLoaderDecorator(loader));
69 c.
insert(QStringLiteral(
"template_var"), QLatin1String(
"template1"));
70 QCOMPARE(t->
render(&c), QString());
71 QCOMPARE(t->
error(), TagSyntaxError);
73 c.
insert(QStringLiteral(
"template_var"), QLatin1String(
"template2"));
74 QCOMPARE(t->
render(&c), QLatin1String(
"Ok"));
75 QCOMPARE(t->
error(), NoError);
79#include "testcachingloader.moc"
void insert(const QString &name, QObject *object)
Cutelee::Engine is the main entry point for creating Cutelee Templates.
Template loadByName(const QString &name) const
void setPluginPaths(const QStringList &dirs)
void addTemplateLoader(std::shared_ptr< AbstractTemplateLoader > loader)
QString render(Context *c) const
The Cutelee namespace holds all public Cutelee API.