2020-02-07 21:10:55 +00:00
|
|
|
#RUN: %fish %s
|
|
|
|
echo $foo[0]
|
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[0]
|
|
|
|
#CHECKERR: ^
|
2021-08-15 18:47:05 +00:00
|
|
|
echo $foo[ 0 ]
|
2020-02-07 21:10:55 +00:00
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[ 0 ]
|
|
|
|
#CHECKERR: ^
|
2021-08-15 18:47:05 +00:00
|
|
|
echo $foo[ 00 ]
|
2020-02-07 21:10:55 +00:00
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[ 00 ]
|
|
|
|
#CHECKERR: ^
|
2021-08-15 18:47:05 +00:00
|
|
|
echo $foo[+0]
|
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[+0]
|
|
|
|
#CHECKERR: ^
|
|
|
|
echo $foo[-0]
|
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[-0]
|
|
|
|
#CHECKERR: ^
|
|
|
|
echo $foo[0..1]
|
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[0..1]
|
|
|
|
#CHECKERR: ^
|
|
|
|
echo $foo[1..0]
|
|
|
|
#CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0.
|
|
|
|
#CHECKERR: echo $foo[1..0]
|
|
|
|
#CHECKERR: ^
|
2020-02-07 21:10:55 +00:00
|
|
|
|
|
|
|
# and make sure these didn't break
|
|
|
|
set -l foo one two three
|
|
|
|
echo $foo[001]
|
|
|
|
#CHECK: one
|