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:
copilot-swe-agent[bot]
2025-10-24 19:47:04 +00:00
parent 27143f2878
commit 05400e5e74

View File

@@ -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