From 0a4f80ec41fc6f7b26f82880c6f8be2ff00a9f3e Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 15 Aug 2021 13:47:05 -0500 Subject: [PATCH] Add more tests for literal zero indexes --- tests/checks/zero_based_array.fish | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/checks/zero_based_array.fish b/tests/checks/zero_based_array.fish index bb41f999b..20992674a 100644 --- a/tests/checks/zero_based_array.fish +++ b/tests/checks/zero_based_array.fish @@ -1,16 +1,32 @@ #RUN: %fish %s echo $foo[0] -echo $foo[ 0 ] -echo $foo[ 00 ] #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[ 00 ] #CHECKERR: {{.*}}checks/zero_based_array.fish (line {{\d+}}): array indices start at 1, not 0. #CHECKERR: echo $foo[ 00 ] #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] +#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: ^ # and make sure these didn't break set -l foo one two three