fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Peter AmmonRevert changes to restore cursor position after undof2dde229a

master
1.1 KiB41 linesraw
1#!/usr/bin/env python3
2from pexpect_helper import SpawnedProc
3
4sp = SpawnedProc()
5send, sendline, sleep, expect_prompt, expect_re, expect_str = (
6    sp.send,
7    sp.sendline,
8    sp.sleep,
9    sp.expect_prompt,
10    sp.expect_re,
11    sp.expect_str,
12)
13expect_prompt()
14
15# Fish should start in default-mode (i.e., emacs) bindings. The default escape
16# timeout is 30ms.
17#
18# Because common CI systems are awful, we have to increase this:
19
20sendline("set -g fish_escape_delay_ms 120")
21expect_prompt("")
22
23# Validate standalone behavior
24sendline("status current-commandline")
25expect_prompt("\r\n.*status current-commandline\r\n")
26
27# Validate behavior as part of a command chain
28sendline("true 7 && status current-commandline")
29expect_prompt("\r\n.*true 7 && status current-commandline\r\n")
30
31# Validate behavior when used in a function
32sendline("function report; set -g last_cmdline (status current-commandline); end")
33expect_prompt("")
34sendline("report 27")
35expect_prompt("")
36sendline("echo $last_cmdline")
37expect_prompt("\r\n.*report 27\r\n")
38
39# Exit
40send("\x04")  # <c-d>
41expect_str("")