* @copyright 2014 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License */ use phpseclib\File\ANSI; 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 ANSI(); $ansi->appendString($str); $expected = '
';
        $expected.= 'aaaaaaaa';
        $expected.= 'bbb';
        $expected.= 'aaaaaaa';
        $expected.= '
'; $this->assertSame($ansi->getScreen(), $expected); } public function testCaseJ() { $str = "\x1B[H"; // Move cursor to upper left corner $str.= "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; $str.= "\x1B[H"; // Move cursor to upper left corner $str.= "\x1B[J"; // Clear screen from cursor down $ansi = new ANSI(); $ansi->appendString($str); $expected = '
';
        $expected.= '
'; $this->assertSame($ansi->getScreen(), $expected); } }