mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 19:53:36 +08:00
3de95038b0
In particular, this allows `true && time true`, or `true; and time true`, and both `time not true` as well as `not time true` (like bash). time is valid only as job _prefix_, so `true | time true` could call `/bin/time` (same in bash) See discussion in #6442
46 lines
1.8 KiB
Fish
46 lines
1.8 KiB
Fish
#RUN: %fish %s
|
|
time sleep 1s
|
|
|
|
# These are a tad awkward because it picks the correct unit and adapts whitespace.
|
|
# The idea is that it's a table.
|
|
#CHECKERR: ________________________________________________________
|
|
#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
|
|
#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
time for i in (seq 1 2)
|
|
echo banana
|
|
end
|
|
|
|
#CHECK: banana
|
|
#CHECK: banana
|
|
#CHECKERR: ________________________________________________________
|
|
#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
|
|
#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
|
|
# Make sure we're not double-parsing
|
|
time echo 'foo -s bar'
|
|
#CHECK: foo -s bar
|
|
#CHECKERR: ________________________________________________________
|
|
#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
|
|
#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
|
|
|
|
true && time a=b not builtin true | true
|
|
#CHECKERR: ___{{.*}}
|
|
#CHECKERR: {{.*}}
|
|
#CHECKERR: {{.*}}
|
|
#CHECKERR: {{.*}}
|
|
|
|
PATH= time true
|
|
#CHECKERR: fish: Unknown command: time
|
|
#CHECKERR: {{.*}}
|
|
#CHECKERR: PATH= time true
|
|
#CHECKERR: ^
|
|
|
|
not time true
|
|
#CHECKERR: ___{{.*}}
|
|
#CHECKERR: {{.*}}
|
|
#CHECKERR: {{.*}}
|
|
#CHECKERR: {{.*}}
|