fork/fish-shell

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

Fabian Boehmpexpects: Fix some escapes36c632889

master
1.4 KiB48 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)
13
14# This test verifies the overall sort order across multiple `complete -k` completions with identical
15# predicates. We check for legacy "reverse what you'd expect" order, as discussed in #9221.
16
17expect_prompt()
18sendline("function fooc; true; end;")
19expect_prompt()
20
21# A non-`complete -k` completion
22sendline('complete -c fooc -fa "alpha delta bravo"')
23expect_prompt()
24
25# A `complete -k` completion chronologically and alphabetically before the next completion. You'd
26# expect it to come first, but we documented that it will come second.
27sendline('complete -c fooc -fka "golf charlie echo"')
28expect_prompt()
29
30# A `complete -k` completion that is chronologically after and alphabetically after the previous
31# one, so a naive sort would place it after but we want to make sure it comes before.
32sendline('complete -c fooc -fka "india foxtrot hotel"')
33expect_prompt()
34
35# Another non-`complete -k` completion
36sendline('complete -c fooc -fa "kilo juliett lima"')
37expect_prompt()
38
39sendline("set TERM xterm")
40expect_prompt()
41
42# Generate completions
43send("fooc \t")
44
45expect_re(
46    "india\\W+hotel\\W+charlie\\W+alpha\\W+delta\\W+kilo\r\n"
47    + "foxtrot\\W+golf\\W+echo\\W+bravo\\W+juliett\\W+lima"
48)