merged branch jfsimon/issue-4885 (PR #4891)
Commits -------3fef3c2
[Console] Fixed output formatter regex.fea9d09
[Console] Added LG char escaping test. Discussion ---------- Issue 4885 Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: #4885
This commit is contained in:
commit
7dc89013eb
@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
/**
|
||||
* The pattern to phrase the format.
|
||||
*/
|
||||
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>([^\\\\<]*)#is';
|
||||
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?:(?!\\\\?<).)*)#is';
|
||||
|
||||
private $decorated;
|
||||
private $styles = array();
|
||||
|
@ -9,6 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
namespace Symfony\Component\Console\Tests\Formatter;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
@ -25,9 +26,15 @@ class FormatterStyleTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLGCharEscaping()
|
||||
{
|
||||
$formatter = new OutputFormatter(true);
|
||||
|
||||
$this->assertEquals("foo<bar", $formatter->format('foo\\<bar'));
|
||||
$this->assertEquals("<info>some info</info>", $formatter->format('\\<info>some info\\</info>'));
|
||||
$this->assertEquals("\\<info>some info\\</info>", OutputFormatter::escape('<info>some info</info>'));
|
||||
|
||||
$this->assertEquals(
|
||||
"\033[33mSymfony\\Component\\Console does work very well!\033[0m",
|
||||
$formatter->format('<comment>Symfony\Component\Console does work very well!</comment>')
|
||||
);
|
||||
}
|
||||
|
||||
public function testBundledStyles()
|
||||
|
Reference in New Issue
Block a user