summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2014-07-20 07:27:20 +0000
committerjquast <contact@jeffquast.com>2014-07-20 07:27:20 +0000
commit52b0f8254708f265d66088a8f974477eac3db5d1 (patch)
tree9a21d4496a7ef7c55e69fedae4c8c8bdafac3c48
parentbc2f43f408a622ccd6dd3e29238d1ff23786cbd5 (diff)
downloadpexpect-doc-and-test-max-cannon-2.tar.gz
make sure to FF beyond cat(1) command for \adoc-and-test-max-cannon-2
Otherwise, \a can be falsley matched by PROMPT_COMMAND, where it is often found in the xterm-set-title sequence!
-rwxr-xr-xtests/test_misc.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_misc.py b/tests/test_misc.py
index bc4f9a9..62b7f16 100755
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -427,12 +427,18 @@ if os.environ.get('TRAVIS', None) != 'true':
# given,
child = pexpect.spawn('bash', echo=False, timeout=2)
child.sendline('stty icanon imaxbel erase ^H')
- child.sendline('cat')
+ child.sendline('echo BEGIN; cat')
send_bytes = self.max_input
# exercise,
child.send('_' * send_bytes)
child.sendline() # rings BEL
+
+ # fast forward beyond 'cat' command, as ^G can be found as part of
+ # set-xterm-title sequence of $PROMPT_COMMAND or $PS1.
+ child.expect_exact('BEGIN')
+
+ # verify, BEL is rung
child.expect_exact('\a')
# verify, no more additional BELs expected
@@ -458,16 +464,21 @@ if os.environ.get('TRAVIS', None) != 'true':
# given,
child = pexpect.spawn('bash', echo=False, timeout=5)
child.sendline('stty -icanon imaxbel')
- child.sendline('cat')
+ child.sendline('echo BEGIN; cat')
send_bytes = self.max_input + 11
# exercise,
child.send('_' * send_bytes)
child.sendline()
+ # fast forward beyond 'cat' command, as ^G can be found as part of
+ # set-xterm-title sequence of $PROMPT_COMMAND or $PS1.
+ child.expect_exact('BEGIN')
+
# BEL is *not* found,
with self.assertRaises(pexpect.TIMEOUT):
child.expect_exact('\a', timeout=1)
+ print(child.buffer)
# verify cat(1) also received all input,
child.expect_exact('_' * send_bytes)