mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 00:01:15 -03:00
Merge branch 'index_range'
This commit is contained in:
0
tests/test8.err
Normal file
0
tests/test8.err
Normal file
25
tests/test8.in
Normal file
25
tests/test8.in
Normal file
@@ -0,0 +1,25 @@
|
||||
# Test index ranges
|
||||
|
||||
echo Test variable expand
|
||||
set n 10
|
||||
set test (seq $n)
|
||||
echo $test[1..$n] # normal range
|
||||
echo $test[$n..1] # inverted range
|
||||
echo $test[2..5 8..6] # several ranges
|
||||
echo $test[-1..-2] # range with negative limits
|
||||
echo $test[-1..1] # range with mixed limits
|
||||
|
||||
echo Test variable set
|
||||
set test1 $test
|
||||
set test1[-1..1] $test; echo $test1
|
||||
set test1[1..$n] $test; echo $test1
|
||||
set test1[$n..1] $test; echo $test1
|
||||
set test1[2..4 -2..-4] $test1[4..2 -4..-2]; echo $test1
|
||||
|
||||
echo Test command substitution
|
||||
echo (seq 5)[-1..1]
|
||||
echo (seq $n)[3..5 -2..2]
|
||||
|
||||
echo Test more
|
||||
echo $test[(count $test)..1]
|
||||
echo $test[1..(count $test)]
|
||||
17
tests/test8.out
Normal file
17
tests/test8.out
Normal file
@@ -0,0 +1,17 @@
|
||||
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 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
|
||||
1
tests/test8.status
Normal file
1
tests/test8.status
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -6,3 +6,4 @@ File test4.in tested ok
|
||||
File test5.in tested ok
|
||||
File test6.in tested ok
|
||||
File test7.in tested ok
|
||||
File test8.in tested ok
|
||||
|
||||
Reference in New Issue
Block a user