Explorar o código

Adding test for delimiter switching in partials

KevBurnsJr %!s(int64=14) %!d(string=hai) anos
pai
achega
7d3f312b4c
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      test/MustacheTest.php

+ 9 - 0
test/MustacheTest.php

@@ -147,6 +147,15 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
 		$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')));
 	}
+	
+	/**
+	 * @group partials
+	 */
+	public function testRenderDelimitersInPartials() {
+		$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('{{first_name}} {{last_name}}', $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.