diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-05-08 01:21:43 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-05-08 01:21:43 +0000 |
commit | 114a12ff12f526c1c8cb748939ccb197e532c5ea (patch) | |
tree | 6d9b343970b5e53c2f47ad6f3da63952d64d4635 | |
parent | fe22fef9e0deca1a44295ea071e0f30e8650e825 (diff) | |
download | pexpect-114a12ff12f526c1c8cb748939ccb197e532c5ea.tar.gz |
This tests the new facility for set and get of child tty window size.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@194 656d521f-e311-0410-88e0-e7920216d269
-rwxr-xr-x | pexpect/tests/test_winsize.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pexpect/tests/test_winsize.py b/pexpect/tests/test_winsize.py new file mode 100755 index 0000000..672818b --- /dev/null +++ b/pexpect/tests/test_winsize.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +import pexpect +import unittest +import time + +class TestCaseWinsize(unittest.TestCase): + def test_winsize (self): + """ + This tests that the child process can set and get the windows size. + This makes use of an external script sigwinch_report.py. + """ + p1 = pexpect.spawn('python sigwinch_report.py') + time.sleep(1) + p1.setwinsize (11,22) + p1.expect ('SIGWINCH: \(([0-9]*), ([0-9]*)\)') + r = p1.match.group(1) + c = p1.match.group(2) + assert (r=="11" and c=="22") + time.sleep(1) + p1.setwinsize (24,80) + p1.expect ('SIGWINCH: \(([0-9]*), ([0-9]*)\)') + r = p1.match.group(1) + c = p1.match.group(2) + assert (r=="24" and c=="80") + +if __name__ == '__main__': + unittest.main() + +suite = unittest.makeSuite(TestCaseWinsize,'test') + |