Improve function detection pattern in test script for accuracy
- Use extended regex to match function definitions with optional whitespace - Prevents false positives from function calls or comments - More robust pattern matching for validation Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
This commit is contained in:
@@ -98,7 +98,8 @@ echo ""
|
||||
echo "Test 8: Checking script functions..."
|
||||
functions=("log" "error_exit" "check_postgres" "full_backup" "full_restore")
|
||||
for func in "${functions[@]}"; do
|
||||
if grep -q "${func}()" ops/backup/backup-database.sh ops/restore/restore-database.sh 2>/dev/null; then
|
||||
# Match function definitions with optional leading whitespace
|
||||
if grep -qE "^[[:space:]]*${func}[[:space:]]*\(\)" ops/backup/backup-database.sh ops/restore/restore-database.sh 2>/dev/null; then
|
||||
echo " ✓ Function $func defined"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user