fish-shell/tests/checks/eval.fish
Fabian Homborg 69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00

59 lines
1.0 KiB
Fish

# RUN: %fish %s
# Regression test for issue #4443
eval set -l previously_undefined foo
echo $previously_undefined
# CHECK: foo
# Test redirection
eval "echo you can\\'t see this 1>&2" 2>/dev/null
# Test return statuses
false
eval true
echo $status
# CHECK: 0
false
eval false
echo $status
# CHECK: 1
# Test return status in case of parsing error
false
eval "("
echo $status
# CHECK: 1
# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): Unexpected end of string, expecting ')'
# CHECKERR: (
# CHECKERR: ^
false
eval '""'
echo $status
# CHECK: 1
# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): The expanded command was empty.
# CHECKERR: ""
# CHECKERR: ^
function empty
end
# Regression tests for issue #5692
false
eval
echo blank eval: $status # 0
# CHECK: blank eval: 0
false
eval ""
echo empty arg eval: $status # 0
# CHECK: empty arg eval: 0
false
eval empty
echo empty function eval $status # 0
# CHECK: empty function eval 0
false
eval "begin; end;"
echo empty block eval: $status # 0
# CHECK: empty block eval: 0