Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assert_regex.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ assert_regex() {
local -r value="${1}"
local -r pattern="${2}"

if [[ '' =~ ${pattern} ]] || (( ${?} == 2 )); then
if [[ '' =~ ${pattern} ]]; (( ${?} == 2 )); then
echo "Invalid extended regular expression: \`${pattern}'" \
| batslib_decorate 'ERROR: assert_regex' \
| fail
Expand Down
5 changes: 5 additions & 0 deletions test/assert_regex.bats
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ Invalid extended regular expression: `[.*'
--
ERR_MSG
}

@test "assert_regex allows regex matching empty string (see #53)" {
run assert_regex any_value '.*'
assert_success
}