fork/fish-shell

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

Noah Hellmantests: use command instead of absolute pathsa0d8d27f4

master
1.4 KiB48 linesraw
1#!/usr/bin/env python3
2from pexpect_helper import SpawnedProc
3import os
4
5sp = SpawnedProc()
6send, sendline, expect_prompt, expect_str = (
7    sp.send,
8    sp.sendline,
9    sp.expect_prompt,
10    sp.expect_str,
11)
12
13expect_prompt()
14sendline("function echo_wrap ; command echo $argv ; sleep 0.1; end")
15expect_prompt()
16
17if not os.environ.get("fish_test_helper", ""):
18    import sys
19
20    sys.exit(127)
21
22for i in range(5):
23    sendline(
24        "echo_wrap 1 2 3 4 | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
25    )
26    expect_prompt("become_foreground_then_print_stderr done")
27
28# 'not' because we expect to have no jobs, in which case `jobs` will return false
29sendline("not jobs")
30expect_prompt("jobs: There are no jobs")
31
32sendline("function inner ; command true ; end; function outer; inner; end")
33expect_prompt()
34for i in range(5):
35    sendline(
36        "outer | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
37    )
38    expect_prompt("become_foreground_then_print_stderr done")
39
40sendline("not jobs")
41expect_prompt("jobs: There are no jobs", unmatched="Should be no jobs")
42
43# Check that this weird invalid double-redirection doesn't crash fish.
44sendline("cat | cat </non/existent/file")
45expect_str("warning: An error occurred while redirecting file '/non/existent/file'")
46expect_str("warning: Path '/non' does not exist")
47send("\x04")
48expect_prompt()