(content string)
| 1484 | |
| 1485 | func matchFailureSnippet(fileContent, oldString string) string { |
| 1486 | oldFirst := strings.TrimSpace(strings.Split(oldString, "\n")[0]) |
| 1487 | if oldFirst == "" { |
| 1488 | return "" |
| 1489 | } |
| 1490 | lines := strings.Split(fileContent, "\n") |
| 1491 | bestIdx, bestScore := -1, 0.0 |
| 1492 | for i, line := range lines { |
| 1493 | score := lineSimilarity(oldFirst, strings.TrimSpace(line)) |
| 1494 | if score > bestScore { |
| 1495 | bestScore = score |
| 1496 | bestIdx = i |
| 1497 | } |
| 1498 | } |
no test coverage detected