From 99d693d647fb256133f6d19095481a76ebb946b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Fri, 28 Jun 2024 07:09:09 -0700 Subject: [PATCH] test_git.sh: replace test regex for glob match Don't quote rhs of =~, it'll match literally rather than as a regex. Fixes SC2076. Part of #891. --- test_git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_git.sh b/test_git.sh index 4868f28..19ada9f 100755 --- a/test_git.sh +++ b/test_git.sh @@ -47,7 +47,7 @@ function assert_eq() { } function assert_substr() { - if [[ "$1" =~ "$2" ]]; then + if [[ "$1" == *"$2"* ]]; then return fi fail "'$1' does not contain '$2'" @@ -855,7 +855,7 @@ for arg; do if [[ "${t}" =~ ${arg} ]]; then nmatches=$((nmatches+1)) # Don't run tests twice, just keep the first match. - if [[ " ${tests_to_run[*]} " =~ " ${t} " ]]; then + if [[ " ${tests_to_run[*]} " == *" ${t} "* ]]; then continue fi tests_to_run+=("${t}")