Permalink
Browse files

Improve test coverage for custom escapers and charsets.

  • Loading branch information...
1 parent c75b4c2 commit 12d6884b4b14fe0287cffcb1eff184477cc9d776 @bobthecow committed Jan 27, 2013
Showing with 37 additions and 5 deletions.
  1. +37 −5 test/Mustache/Test/CompilerTest.php
@@ -42,11 +42,43 @@ public function getCompileValues()
'return $buffer;',
)),
- array('', array($this->createTextToken('TEXT')), 'Monkey', true, 'ISO-8859-1', array(
- "\nclass Monkey extends Mustache_Template",
- '$buffer .= $indent . \'TEXT\';',
- 'return $buffer;',
- )),
+ array(
+ '',
+ array(
+ array(
+ Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
+ Mustache_Tokenizer::NAME => 'name',
+ )
+ ),
+ 'Monkey',
+ true,
+ 'ISO-8859-1',
+ array(
+ "\nclass Monkey extends Mustache_Template",
+ '$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
+ '$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
+ 'return $buffer;',
+ )
+ ),
+
+ array(
+ '',
+ array(
+ array(
+ Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
+ Mustache_Tokenizer::NAME => 'name',
+ )
+ ),
+ 'Monkey',
+ false,
+ 'ISO-8859-1',
+ array(
+ "\nclass Monkey extends Mustache_Template",
+ '$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
+ '$buffer .= $indent . htmlspecialchars($value, ENT_COMPAT, \'ISO-8859-1\');',
+ 'return $buffer;',
+ )
+ ),
array(
'',

0 comments on commit 12d6884

Please sign in to comment.