fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
9d904e111
master
1#RUN: fish=%fish %fish %s 2 3$fish -c"echo 1.2.3.4." 4# CHECK: 1.2.3.4. 5 6PATH= $fish -c"command a" 2> /dev/null 7echo $status 8# CHECK: 127 9 10PATH= $fish -c"echo (command a)" 2> /dev/null 11echo $status 12# CHECK: 127 13 14if not set -q GITHUB_WORKFLOW 15$fish -c'if status --is-login ; echo login shell ; else ; echo not login shell ; end; if status --is-interactive ; echo interactive ; else ; echo not interactive ; end' -i 16# CHECK: not login shell 17# CHECK: interactive 18$fish -c'if status --is-login ; echo login shell ; else ; echo not login shell ; end; if status --is-interactive ; echo interactive ; else ; echo not interactive ; end' -l -i 19# CHECK: login shell 20# CHECK: interactive 21else 22# GitHub Action doesn't start this in a terminal, so fish would complain. 23# Instead, we just fake the result, since we have no way to indicate a skipped test. 24echo not login shell 25echo interactive 26echo login shell 27echo interactive 28end 29 30$fish -c'if status --is-login ; echo login shell ; else ; echo not login shell ; end; if status --is-interactive ; echo interactive ; else ; echo not interactive ; end' -l 31# CHECK: login shell 32# CHECK: not interactive 33 34$fish -c'if status --is-login ; echo login shell ; else ; echo not login shell ; end; if status --is-interactive ; echo interactive ; else ; echo not interactive ; end' 35# CHECK: not login shell 36# CHECK: not interactive 37 38$fish -c'if status --is-login ; echo login shell ; else ; echo not login shell ; end; if status --is-interactive ; echo interactive ; else ; echo not interactive ; end' -l 39# CHECK: login shell 40# CHECK: not interactive 41 42# Arguments for -c 43$fish -c'string escape $argv' 1 2 3 44# CHECK: 1 45# CHECK: 2 46# CHECK: 3 47 48# Two -cs 49$fish -c'string escape y$argv' -c'string escape x$argv' 1 2 3 50# CHECK: y1 51# CHECK: y2 52# CHECK: y3 53# CHECK: x1 54# CHECK: x2 55# CHECK: x3 56 57# Should just do nothing. 58$fish --no-execute 59 60set -l tmp( mktemp -d) 61$fish --profile$tmp /normal.prof --profile-startup$tmp /startup.prof -ic exit 62 63# This should be the full file - just the one command we gave explicitly! 64cat $tmp /normal.prof 65# CHECK: Time (μs){{\s+}}Sum (μs){{\s+}}Command 66# CHECK: {{\d+\s+\d+\s+>}} exit 67 68string match -rq"builtin source " < $tmp /startup.prof 69and echo matched 70# CHECK: matched 71 72# See that sending both profiles to the same file works. 73$fish --profile$tmp /full.prof --profile-startup$tmp /full.prof -c'echo thisshouldneverbeintheconfig' 74# CHECK: thisshouldneverbeintheconfig 75string match -rq"builtin source " < $tmp /full.prof 76and echo matched 77# CHECK: matched 78string match -rq"echo thisshouldneverbeintheconfig" < $tmp /full.prof 79and echo matched 80# CHECK: matched 81 82# See that profiling without startup actually gives us just the command 83$fish --no-config --profile$tmp /nostartup.prof -c'echo foo' 84# CHECK: foo 85count < $tmp /nostartup.prof 86# CHECK: 2 87 88$fish --no-config -c'echo notprinted; echo foo | exec true; echo banana' 89# CHECKERR: fish: The 'exec' command can not be used in a pipeline 90# CHECKERR: echo notprinted; echo foo | exec true; echo banana 91# CHECKERR: ^~~~~~~~^ 92 93# Running multiple command lists continues even if one has a syntax error. 94$fish --no-config -c'echo $$ oh no syntax error' -c'echo this works' 95# CHECK: this works 96# CHECKERR: fish: $$ is not the pid. In fish, please use $fish_pid. 97# CHECKERR: echo $$ oh no syntax error 98# CHECKERR: ^ 99 100$fish --no-config . 101# CHECKERR: error: Unable to read input file: Is a directory 102# CHECKERR: warning: Error while reading file . 103 104$fish --no-config -c'echo notprinted; echo foo; a=b' 105# CHECKERR: fish: Unsupported use of '='. In fish, please use 'set a b'. 106# CHECKERR: echo notprinted; echo foo; a=b 107# CHECKERR: ^~^ 108 109$fish --no-config -c'echo notprinted | and true' 110# CHECKERR: fish: The 'and' command can not be used in a pipeline 111# CHECKERR: echo notprinted | and true 112# CHECKERR: ^~^ 113 114$fish --no-config --features 115# CHECKERR: fish: --features: option requires an argument 116 117# Regression test for a hang. 118echo "set -L" | $fish > /dev/null