mirror of
https://github.com/danog/tgseclib.git
synced 2024-11-27 12:44:38 +01:00
Tests: add ANSI unit test
This commit is contained in:
parent
48191bdeec
commit
4f19085e68
31
tests/Unit/File/ANSITest.php
Normal file
31
tests/Unit/File/ANSITest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Jim Wigginton <terrafrost@php.net>
|
||||
* @copyright 2014 Jim Wigginton
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*/
|
||||
|
||||
require_once 'File/ANSI.php';
|
||||
|
||||
class Unit_File_ANSITest extends PhpseclibTestCase
|
||||
{
|
||||
public function testCase1()
|
||||
{
|
||||
$str = "\x1B[07m"; // turn reverse video on
|
||||
$str.= "aaaaaaaaaaaaaaaaaa";
|
||||
$str.= "\x1B[10D"; // move cursor left 10 lines
|
||||
$str.= "\x1B[m"; // reset everything
|
||||
$str.= "bbb";
|
||||
|
||||
$ansi = new File_ANSI();
|
||||
$ansi->appendString($str);
|
||||
|
||||
$expected = '<pre width="80" style="color: white; background: black">';
|
||||
$expected.= '<span style="color: black"><span style="background: white">aaaaaaaa</span></span>';
|
||||
$expected.= 'bbb';
|
||||
$expected.= '<span style="color: black"><span style="background: white">aaaaaaa</span></span>';
|
||||
$expected.= '</pre>';
|
||||
|
||||
$this->assertSame($ansi->getScreen(), $expected);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user