summaryrefslogtreecommitdiff
path: root/tests/test_run.py
diff options
context:
space:
mode:
authorHideaki Suzuki <h2suzuki@gmail.com>2014-10-11 16:27:53 +0900
committerHideaki Suzuki <h2suzuki@gmail.com>2014-10-11 16:30:51 +0900
commit1eb3e95da705b2ae5a44ef113edfa61ad681bd94 (patch)
tree8cf4f33c4e3ed2553aa4994affc76e763570b958 /tests/test_run.py
parent170d52a251b30f528fc35fecb8af9d14c775e96a (diff)
downloadpexpect-1eb3e95da705b2ae5a44ef113edfa61ad681bd94.tar.gz
Modify run() to allow a tuple list of events.
This is a feature enhancement mentioned by #116.
Diffstat (limited to 'tests/test_run.py')
-rwxr-xr-xtests/test_run.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_run.py b/tests/test_run.py
index 814b70a..077f857 100755
--- a/tests/test_run.py
+++ b/tests/test_run.py
@@ -64,6 +64,14 @@ class RunFuncTestCase(PexpectTestCase.PexpectTestCase):
withexitstatus=1)
assert exitstatus != 0
+ def test_run_tuple_list (self):
+ events = [('abc\r\n.*[$#]','echo "def"\n'),
+ ('def\r\n.*[$#]','exit\n'),
+ ('[$#] ','echo "abc"\n')]
+ (data, exitstatus) = pexpect.run('bash', withexitstatus=1,
+ events=events, timeout=10)
+ assert exitstatus == 0
+
class RunUnicodeFuncTestCase(RunFuncTestCase):
runfunc = staticmethod(pexpect.runu)
cr = b'\r'.decode('ascii')