fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
4ffa06fb7
master
1#RUN: fish=%fish %fish %s 2# Test that using variables as command names work correctly. 3 4$EMPTY_VARIABLE 5#CHECKERR: {{.*}}checks/vars_as_commands.fish (line {{\d+}}): The expanded command was empty. 6#CHECKERR: $EMPTY_VARIABLE 7#CHECKERR: ^~~~~~~~~~~~~~^ 8" $EMPTY_VARIABLE " 9#CHECKERR: {{.*}}checks/vars_as_commands.fish (line {{\d+}}): The expanded command was empty. 10#CHECKERR: "$EMPTY_VARIABLE" 11#CHECKERR: ^~~~~~~~~~~~~~~~^ 12 13set CMD1 echo basic command as variable 14$CMD1 15#CHECK: basic command as variable 16 17set CMD2 echo'(' not expanded again 18$CMD2 19#CHECK: ( not expanded again 20 21# Test using variables with the builtin decorator 22builtin $CMD1 23#CHECK: basic command as variable 24 25# Test implicit cd 26set CMD3 /usr/bin 27$CMD3 && echo $PWD 28#CHECK: /usr/bin 29 30# $status specifically is not valid, to avoid a common error 31# with `if $status` 32echo 'if $status; echo foo; end' | $fish --no-config 33#CHECKERR: fish: $status is not valid as a command. See `help language#conditions` 34#CHECKERR: if $status; echo foo; end 35#CHECKERR: ^~~~~~^ 36echo 'not $status' | $fish --no-config 37#CHECKERR: fish: $status is not valid as a command. See `help language#conditions` 38#CHECKERR: not $status 39#CHECKERR: ^~~~~~^ 40 41# Script doesn't run at all. 42echo 'echo foo; and $status' | $fish --no-config 43#CHECKERR: fish: $status is not valid as a command. See `help language#conditions` 44#CHECKERR: echo foo; and $status 45#CHECKERR: ^~~~~~^ 46 47echo 'set -l status_cmd true; if $status_cmd; echo Heck yes this is true; end' | $fish --no-config 48#CHECK: Heck yes this is true 49 50foo=bar $NONEXISTENT -c'set foo 1 2 3; set --show foo' 51#CHECKERR: {{.*}}checks/vars_as_commands.fish (line {{\d+}}): The expanded command was empty. 52#CHECKERR: foo=bar $NONEXISTENT -c 'set foo 1 2 3; set --show foo' 53#CHECKERR: ^~~~~~~~~~~^ 54 55exit 0