Correct parameter order of pexpect.expect_prompt

Ensure that the increment= param is set via keyword, not via positional arg.
This mistake was masking a bug where the "^a b c" match was not being tested,
because it was being set as the value for increment!
This commit is contained in:
ridiculousfish 2020-10-06 16:03:06 -07:00
parent 9e1800cb96
commit 63cf3e972f
2 changed files with 3 additions and 3 deletions

View file

@ -200,7 +200,7 @@ class SpawnedProc(object):
""" Cover over expect_re() which accepts a literal string. """
return self.expect_re(re.escape(s), **kwargs)
def expect_prompt(self, increment=True, *args, **kwargs):
def expect_prompt(self, *args, increment=True, **kwargs):
""" Convenience function which matches some text and then a prompt.
Match the given positional arguments as expect_re, and then look
for a prompt.

View file

@ -283,9 +283,9 @@ expect_prompt()
send("a b c d\x01") # ctrl-a, move back to the beginning of the line
send("\x07") # ctrl-g, kill bigword
sendline("echo")
expect_prompt("^b c d")
expect_prompt("\nb c d")
send(" a b c d\x01") # ctrl-a, move back to the beginning of the line
send("\x07") # ctrl-g, kill bigword
sendline("echo")
expect_prompt("^b c d")
expect_prompt("\nb c d")