fork/fish-shell

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

Fabian Boehmtests: Override __fish_print_help6627d403d

master
2.7 KiB76 linesraw
1#RUN: fish=%fish %fish %s
2time sleep 0
3
4# These are a tad awkward because it picks the correct unit and adapts whitespace.
5# The idea is that it's a table.
6#CHECKERR: ________________________________________________________
7#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
8#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
9#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
10time for i in (seq 1 2)
11    echo banana
12end
13
14#CHECK: banana
15#CHECK: banana
16#CHECKERR: ________________________________________________________
17#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
18#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
19#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
20
21# Make sure we're not double-parsing
22time echo 'foo -s   bar'
23#CHECK: foo -s   bar
24#CHECKERR: ________________________________________________________
25#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
26#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
27#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
28
29true && time a=b not builtin true | true
30#CHECKERR: ___{{.*}}
31#CHECKERR: {{.*}}
32#CHECKERR: {{.*}}
33#CHECKERR: {{.*}}
34
35not time true
36#CHECKERR: ___{{.*}}
37#CHECKERR: {{.*}}
38#CHECKERR: {{.*}}
39#CHECKERR: {{.*}}
40
41not time a=b true
42#CHECKERR: ___{{.*}}
43#CHECKERR: {{.*}}
44#CHECKERR: {{.*}}
45#CHECKERR: {{.*}}
46
47# Currently illegal syntax. Same in zsh. POSIX shells call the external command "time" here.
48a=b time true
49#CHECKERR: Documentation for time
50not a=b time true
51#CHECKERR: Documentation for time
52
53$fish -c 'time true&'
54#CHECKERR: fish: {{.*}}
55#CHECKERR: time true&
56#CHECKERR: ^~~~~~~~~^
57
58$fish -c 'not time true&'
59#CHECKERR: fish: {{.*}}
60#CHECKERR: not time true&
61#FIXME: This error marks the entire statement. Would be cool to mark just `time true&`.
62#CHECKERR: ^~~~~~~~~~~~~^
63
64$fish -c 'echo Is it time yet | time cat'
65#CHECKERR: fish: The 'time' command may only be at the beginning of a pipeline
66#CHECKERR: echo Is it time yet | time cat
67#CHECKERR:                       ^~~~~~~^
68
69begin
70    printf '%s\n' "#!/bin/sh" 'echo No this is Patrick' > time
71    chmod +x time
72    set -l PATH .
73    echo Hello is this time | command time
74    # CHECK: No this is Patrick
75end
76rm time