[Console] Added LG char escaping test.

This commit is contained in:
jfsimon 2012-07-13 11:05:48 +02:00
parent bd18907150
commit fea9d0978e

View File

@ -9,6 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Component\Console\Tests\Formatter; namespace Symfony\Component\Console\Tests\Formatter;
use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatter;
@ -25,9 +26,15 @@ class FormatterStyleTest extends \PHPUnit_Framework_TestCase
public function testLGCharEscaping() public function testLGCharEscaping()
{ {
$formatter = new OutputFormatter(true); $formatter = new OutputFormatter(true);
$this->assertEquals("foo<bar", $formatter->format('foo\\<bar')); $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>", $formatter->format('\\<info>some info\\</info>'));
$this->assertEquals("\\<info>some info\\</info>", OutputFormatter::escape('<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() public function testBundledStyles()