From 4f19085e68822d4a64c1a007640a4d0c5def3ca6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 23 May 2015 17:41:16 -0500 Subject: [PATCH] Tests: add ANSI unit test --- tests/Unit/File/ANSITest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Unit/File/ANSITest.php diff --git a/tests/Unit/File/ANSITest.php b/tests/Unit/File/ANSITest.php new file mode 100644 index 00000000..dbb67af0 --- /dev/null +++ b/tests/Unit/File/ANSITest.php @@ -0,0 +1,31 @@ + + * @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 = '
';
+        $expected.= 'aaaaaaaa';
+        $expected.= 'bbb';
+        $expected.= 'aaaaaaa';
+        $expected.= '
'; + + $this->assertSame($ansi->getScreen(), $expected); + } +}