diff options
author | Martin Schulze <37703201+martin-schulze-vireso@users.noreply.github.com> | 2022-03-04 08:59:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-04 08:59:08 +0300 |
commit | 41e280456c2344ee50aa86e1fffac69f1289183c (patch) | |
tree | 44aef42539461c4cef9b5ff4595cd5000c6e3b0f | |
parent | 9d89318868c6d7f7ef61e14c303d46a63fba00ec (diff) | |
parent | 6ba332f34526819d06461704c57b7642f0f1e024 (diff) |
Merge pull request #30 from nkakouros-forks/negative_index
Allows negative indexes in line assertions
-rw-r--r-- | src/assert_line.bash | 2 | ||||
-rw-r--r-- | src/refute_line.bash | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/assert_line.bash b/src/assert_line.bash index c0f68de..ee05bb8 100644 --- a/src/assert_line.bash +++ b/src/assert_line.bash @@ -137,7 +137,7 @@ assert_line() { while (( $# > 0 )); do case "$1" in -n|--index) - if (( $# < 2 )) || ! [[ $2 =~ ^([0-9]|[1-9][0-9]+)$ ]]; then + if (( $# < 2 )) || ! [[ $2 =~ ^-?([0-9]|[1-9][0-9]+)$ ]]; then echo "\`--index' requires an integer argument: \`$2'" \ | batslib_decorate 'ERROR: assert_line' \ | fail diff --git a/src/refute_line.bash b/src/refute_line.bash index c9aa47f..689bea1 100644 --- a/src/refute_line.bash +++ b/src/refute_line.bash @@ -140,7 +140,7 @@ refute_line() { while (( $# > 0 )); do case "$1" in -n|--index) - if (( $# < 2 )) || ! [[ $2 =~ ^([0-9]|[1-9][0-9]+)$ ]]; then + if (( $# < 2 )) || ! [[ $2 =~ ^-?([0-9]|[1-9][0-9]+)$ ]]; then echo "\`--index' requires an integer argument: \`$2'" \ | batslib_decorate 'ERROR: refute_line' \ | fail |