uneven braces with custom delimiters throws Mustache_Exception_SyntaxException

This commit is contained in:
steve
2014-06-19 23:25:46 -07:00
parent c037b31d25
commit 6ba77964b8
2 changed files with 35 additions and 0 deletions
+27
View File
@@ -35,6 +35,17 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
$tokenizer->scan($text, null);
}
/**
* @expectedException Mustache_Exception_SyntaxException
*/
public function testUnevenBracesWithCustomDelimiterThrowExceptions()
{
$tokenizer = new Mustache_Tokenizer;
$text = "<%{ name %>";
$tokenizer->scan($text, "<% %>");
}
public function getTokens()
{
return array(
@@ -246,6 +257,22 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
),
)
),
// unescaped custom delimiters are properly parsed
array(
"<%{ a }%>",
"<% %>",
array(
array(
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
Mustache_Tokenizer::NAME => 'a',
Mustache_Tokenizer::OTAG => '<%',
Mustache_Tokenizer::CTAG => '%>',
Mustache_Tokenizer::LINE => 0,
Mustache_Tokenizer::INDEX => 9,
)
)
),
);
}
}