Minor test coverage improvements.

Add regression test for newlines in comments. Add rudimentary partials test.
This commit is contained in:
Justin Hileman
2010-08-15 06:54:54 -04:00
parent 39b24c1933
commit e2546d40c1
+17
View File
@@ -141,6 +141,23 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa'))); $this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa')));
} }
public function testRenderWithPartials() {
$m = new Mustache('{{>stache}}', null, array('stache' => '{{first_name}} {{last_name}}'));
$this->assertEquals('Charlie Chaplin', $m->render(null, array('first_name' => 'Charlie', 'last_name' => 'Chaplin')));
$this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa')));
}
/**
* Mustache should allow newlines (and other whitespace) in comments and all other tags.
*
* @access public
* @return void
*/
public function testNewlinesInComments() {
$m = new Mustache("{{! comment \n \t still a comment... }}");
$this->assertEquals('', $m->render());
}
/** /**
* Mustache should return the same thing when invoked multiple times. * Mustache should return the same thing when invoked multiple times.
* *