forked from nette/nette
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latte: try to fix parsing of malformed macros [nette#711]
- Loading branch information
Showing
2 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Nette\Latte\Parser::parse() - invalid macro. | ||
* | ||
* @author Michael Moravec | ||
* @package Nette\Latte | ||
* @subpackage UnitTests | ||
*/ | ||
|
||
use Nette\Latte; | ||
|
||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
require __DIR__ . '/Template.inc'; | ||
|
||
|
||
|
||
$parser = new Latte\Parser(); | ||
|
||
Assert::throws(function () use ($parser) { | ||
$parser->parse('{var foo = \'nette}'); | ||
}, 'Nette\Latte\CompileException', 'Malformed macro declaration {%a%}.'); | ||
Assert::throws(function () use ($parser) { | ||
$parser->parse('{var foo = nette\'}'); | ||
}, 'Nette\Latte\CompileException', 'Malformed macro declaration {%a%}.'); | ||
Assert::throws(function () use ($parser) { | ||
$parser->parse('{var foo = "nette}'); | ||
}, 'Nette\Latte\CompileException', 'Malformed macro declaration {%a%}.'); | ||
Assert::throws(function () use ($parser) { | ||
$parser->parse('{var foo = nette"}'); | ||
}, 'Nette\Latte\CompileException', 'Malformed macro declaration {%a%}.'); |