Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec fixes #6

Merged
merged 3 commits into from Aug 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/mustache.cpp
Expand Up @@ -427,9 +427,13 @@ void Renderer::readSetDelimiter(const QString& content, int pos, int endPos)
QString startMarker;
QString endMarker;

while (content.at(pos).isSpace() && pos < endPos) {
++pos;
}

while (!content.at(pos).isSpace() && pos < endPos) {
if (content.at(pos) == '=') {
setError("Custom delimiters may not contain '=' or spaces.", pos);
setError("Custom delimiters may not contain '='.", pos);
return;
}
startMarker += content.at(pos);
Expand All @@ -440,9 +444,9 @@ void Renderer::readSetDelimiter(const QString& content, int pos, int endPos)
++pos;
}

while (pos < endPos - 1) {
if (content.at(pos) == '=' || content.at(pos).isSpace()) {
setError("Custom delimiters may not contain '=' or spaces.", pos);
while (!content.at(pos).isSpace() && pos < endPos - 1) {
if (content.at(pos) == '=') {
setError("Custom delimiters may not contain '='.", pos);
return;
}
endMarker += content.at(pos);
Expand Down
3 changes: 1 addition & 2 deletions tests/test_mustache.cpp
Expand Up @@ -182,7 +182,7 @@ void TestMustache::testSetDelimiters()

renderer.setTagMarkers("{{", "}}");
output = renderer.render("{{== ==}}", &context);
QCOMPARE(renderer.error(), QString("Custom delimiters may not contain '=' or spaces."));
QCOMPARE(renderer.error(), QString("Custom delimiters may not contain '='."));
}

void TestMustache::testErrors()
Expand Down Expand Up @@ -431,7 +431,6 @@ void TestMustache::testConformance()
QEXPECT_FAIL("delimiters.json - Standalone Line Endings", "TODO", Abort);
QEXPECT_FAIL("delimiters.json - Standalone Without Previous Line", "TODO", Abort);
QEXPECT_FAIL("delimiters.json - Standalone Without Newline", "TODO", Abort);
QEXPECT_FAIL("delimiters.json - Pair with Padding", "TODO", Abort);
QEXPECT_FAIL("interpolation.json - Dotted Names - Basic Interpolation", "TODO", Abort);
QEXPECT_FAIL("interpolation.json - Dotted Names - Triple Mustache Interpolation", "TODO", Abort);
QEXPECT_FAIL("interpolation.json - Dotted Names - Ampersand Interpolation", "TODO", Abort);
Expand Down