Rework increment param in pexpect.expect_prompt

This switches the 'increment' param from "after" to "before." Instead
of expect_prompt saying if the next prompt will be incremented, each
call site says if it should have been incremented sinec the last prompt.
This commit is contained in:
ridiculousfish
2020-10-06 14:22:35 -07:00
parent d8af0d2eec
commit 9e1800cb96
2 changed files with 11 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ from pexpect_helper import SpawnedProc
sp = SpawnedProc()
send, sendline, sleep, expect_prompt = sp.send, sp.sendline, sp.sleep, sp.expect_prompt
expect_prompt(increment=False)
expect_prompt()
# Clear twice (regression test for #7280).
send("\f")
@@ -280,12 +280,12 @@ expect_prompt("qqq", unmatched="Leading qs not stripped")
# Test bigword with single-character words.
sendline("bind \cg kill-bigword")
expect_prompt()
send("a b c d\x01") # ctrl-a, move back to the beginning of the line
send("\x07") # ctrl-g, kill bigword
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")
send(" a b c d\x01") # ctrl-a, move back to the beginning of the line
send("\x07") # ctrl-g, kill bigword
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")