Harden diagnostic handling and warning presentation

This commit is contained in:
2026-08-27 18:41:59 +00:00
parent 1025001f20
commit 079d5af337
67 changed files with 518 additions and 318 deletions

View File

@@ -155,7 +155,7 @@ func TestNormalizeCanonicalizesNamesAndReportsUnresolvedNames(t *testing.T) {
}
}
func TestNormalizeLimitsWarningsWithoutChangingSpellValues(t *testing.T) {
func TestNormalizeLimitsFindingsWithoutChangingSpellValues(t *testing.T) {
input := dnd.SpellList{SpellCasts: make([]dnd.SpellCast, contracts.MaxDiagnosticSamples+1)}
for index := range input.SpellCasts {
input.SpellCasts[index].Spell = fmt.Sprintf("Unknown Spell %d", index)
@@ -241,7 +241,7 @@ func TestNormalizeReportsDuplicateRemovalWithoutOrderChange(t *testing.T) {
}
message := diagnostic.Samples[0].Message
if !strings.Contains(message, "order changed false") || !strings.Contains(message, "duplicates removed 1") {
t.Fatalf("warning = %q, want duplicate-only repair without order change", message)
t.Fatalf("finding = %q, want duplicate-only repair without order change", message)
}
}
@@ -406,7 +406,7 @@ func TestNormalizeDoesNotCollapseAdjacentOrOverlappingEvidence(t *testing.T) {
}
}
func TestNormalizeBoundsDuplicateWarningIndices(t *testing.T) {
func TestNormalizeBoundsDuplicateFindingIndices(t *testing.T) {
doc := sourceDocument(2)
ref := source.SourceRef{SourceID: "source", StartUnitID: 1, EndUnitID: 1}
casts := make([]dnd.SpellCast, 22)
@@ -423,7 +423,7 @@ func TestNormalizeBoundsDuplicateWarningIndices(t *testing.T) {
}
message := diagnostic.Samples[0].Message
if !strings.Contains(message, "removed input indices [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]") || strings.Contains(message, ", 21]") || !strings.Contains(message, "1 additional removed input indices omitted") {
t.Fatalf("warning message = %q, want 20 displayed indices and exact omitted count", message)
t.Fatalf("finding message = %q, want 20 displayed indices and exact omitted count", message)
}
}