mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-28 04:03:39 +08:00
4b079e16e5
Variables set in if and while conditions are in the enclosing block, not the if/while statement block. For example: if set -l var (somecommand) ; end echo $var will now work as expected. Fixes #4820. Fixes #1212.
43 lines
736 B
Plaintext
43 lines
736 B
Plaintext
|
|
####################
|
|
# Test variable expand
|
|
1 2 3 4 5 6 7 8 9 10
|
|
10 9 8 7 6 5 4 3 2 1
|
|
2 3 4 5 8 7 6
|
|
10 9
|
|
10 9 8 7 6 5 4 3 2 1
|
|
|
|
####################
|
|
# Test variable set
|
|
10 9 8 7 6 5 4 3 2 1
|
|
1 2 3 4 5 6 7 8 9 10
|
|
10 9 8 7 6 5 4 3 2 1
|
|
10 7 8 9 6 5 2 3 4 1
|
|
|
|
####################
|
|
# Test using slices of command substitution
|
|
5 4 3 2 1
|
|
3 4 5 9 8 7 6 5 4 3 2
|
|
|
|
####################
|
|
# Test more
|
|
10 9 8 7 6 5 4 3 2 1
|
|
1 2 3 4 5 6 7 8 9 10
|
|
|
|
####################
|
|
# Verify that if statements swallow failure
|
|
0
|
|
|
|
####################
|
|
# Verify and/or behavior with if and while statements
|
|
success1
|
|
success2
|
|
success3
|
|
success4
|
|
|
|
####################
|
|
# Catch this corner case, which should produce an error
|
|
|
|
####################
|
|
# Loop control in conditions
|