tests/pexpect: Fix \d escape

This commit is contained in:
Fabian Boehm 2024-04-02 22:40:45 +02:00
parent 171869858a
commit 3af849d739
3 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ expect_prompt("echo start2.*\r\necho start1")
# Verify searching with a request for timestamps includes the timestamps.
sendline("history search --show-time='# %F %T%n' --prefix 'echo start'")
expect_prompt(
"# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start2; .*\r\n# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start1;"
"# \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d\r\necho start2; .*\r\n# \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d\r\necho start1;"
)
# ==========

View File

@ -45,7 +45,7 @@ expect_re("Job.*Group.*(CPU)?.*State.*Command")
expect_re(".*running.*sleep 20 &")
expect_prompt()
sendline("echo $my_pid")
m = expect_re("\d+\r\n")
m = expect_re("\\d+\r\n")
expect_prompt()
os.kill(int(m.group()), signal.SIGTERM)
expect_re("[0-9]+:0:sleep 20 &:SIGTERM:Polite quit request", timeout=20)

View File

@ -83,10 +83,10 @@ expect_prompt()
# Save the pids for later to check if they are still running.
pids = []
send("sleep 130 & echo $last_pid\r")
pids += [expect_re("\d+\r\n").group().strip()]
pids += [expect_re("\\d+\r\n").group().strip()]
expect_prompt()
send("sleep 131 & echo $last_pid\r")
pids += [expect_re("\d+\r\n").group().strip()]
pids += [expect_re("\\d+\r\n").group().strip()]
expect_prompt()
send("sleep 9999999\r")
sleep(0.500) # ensure fish kicks off the above sleep before it gets HUP - see #7288