summaryrefslogtreecommitdiff
path: root/tests/test_ctrl_chars.py
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2014-05-27 03:34:02 +0000
committerjquast <contact@jeffquast.com>2014-05-27 03:34:02 +0000
commite6b716fd1ffb96ad19fd14fffb4c63c5e2b6c0a6 (patch)
treefdb36924f7926743f154ffd6a847e261c058eb28 /tests/test_ctrl_chars.py
parentc4359ad421a6d75a4b8859f7fdcb21c568173865 (diff)
downloadpexpect-solaris-experiments.tar.gz
just pushing up all solaris experimentssolaris-experiments
will be re-working a new branch
Diffstat (limited to 'tests/test_ctrl_chars.py')
-rwxr-xr-xtests/test_ctrl_chars.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/test_ctrl_chars.py b/tests/test_ctrl_chars.py
index 336337c..46d39a1 100755
--- a/tests/test_ctrl_chars.py
+++ b/tests/test_ctrl_chars.py
@@ -24,6 +24,7 @@ import pexpect
import unittest
import PexpectTestCase
import time
+import termios
import sys
if sys.version_info[0] >= 3:
@@ -53,16 +54,29 @@ class TestCtrlChars(PexpectTestCase.PexpectTestCase):
msg = msg + str(err)
self.fail(msg)
+ def test_sendeof (self):
+ child = None
+ try:
+ child = pexpect.spawn('python getch.py')
+ child.expect('READY', timeout=5)
+ child.sendeof()
+ child.expect ('{0}\r\n'.format(termios.CEOF))
+ except Exception:
+ err = sys.exc_info()[1]
+ self.fail("Did not echo character value: %s, %s\n%s" % (
+ repr(chr(termios.CEOF)), str(err), child))
+
def test_sendintr (self):
+ child = None
try:
child = pexpect.spawn('python getch.py')
child.expect('READY', timeout=5)
child.sendintr()
- child.expect ('3\r\n')
+ child.expect ('{0}\r\n'.format(termios.CINTR))
except Exception:
err = sys.exc_info()[1]
- self.fail("Did not echo character value: 3, %s\n%s\n%s" % (
- str(err), child.before, child.after,))
+ self.fail("Did not echo character value: %s, %s\n%s" % (
+ repr(chr(termios.CINTR)), str(err), child))
def test_bad_sendcontrol_chars (self):
'''This tests that sendcontrol will return 0 for an unknown char. '''