Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bats-core/bats-assert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schulze <37703201+martin-schulze-vireso@users.noreply.github.com>2022-03-04 08:59:08 +0300
committerGitHub <noreply@github.com>2022-03-04 08:59:08 +0300
commit41e280456c2344ee50aa86e1fffac69f1289183c (patch)
tree44aef42539461c4cef9b5ff4595cd5000c6e3b0f
parent9d89318868c6d7f7ef61e14c303d46a63fba00ec (diff)
parent6ba332f34526819d06461704c57b7642f0f1e024 (diff)
Merge pull request #30 from nkakouros-forks/negative_index
Allows negative indexes in line assertions
-rw-r--r--src/assert_line.bash2
-rw-r--r--src/refute_line.bash2
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