File: generic.py

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (66 lines) | stat: -rw-r--r-- 1,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
from pexpect_helper import SpawnedProc

sp = SpawnedProc()
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
    sp.send,
    sp.sendline,
    sp.sleep,
    sp.expect_prompt,
    sp.expect_re,
    sp.expect_str,
)
expect_prompt()

# ensure the Apple key () is typeable
sendline("echo \xf8ff")
expect_prompt("\xf8ff")

# check that history is returned in the right order (#2028)
# first send 'echo stuff'
sendline("echo stuff")
expect_prompt("stuff")

# last history item should be 'echo stuff'
sendline("echo $history[1]")
expect_prompt("echo stuff")

# last history command should be the one that printed the history
sendline("echo $history[1]")
expect_prompt("echo \\$history\\[1\\]")

# Backslashes at end of comments (#1255)
# This backslash should NOT cause the line to continue
sendline("echo -n #comment\\")
expect_prompt()

# a pipe at the end of the line (#1285)
sendline("echo hoge |\n cat")
expect_prompt("hoge")

sendline("echo hoge |    \n cat")
expect_prompt("hoge")

sendline("echo hoge 2>|  \n cat")
expect_prompt("hoge")
sendline("echo hoge >|  \n cat")
expect_prompt("hoge")

sendline("$fish --no-execute 2>&1")
expect_prompt("error: no-execute mode enabled and no script given. Exiting")

sendline("source; or echo failed")
expect_prompt("failed")

# See that `type` tells us the function was defined interactively.
sendline("function foo; end; type foo")
expect_str("foo is a function with definition\r\n")
expect_str("# Defined interactively\r\n")
expect_str("function foo")
expect_str("end")
expect_prompt()

# See that `functions` terminates
sendline("functions")
expect_re(".*fish_prompt,")
expect_prompt()