Classify remaining D&D producer diagnostics
This commit is contained in:
@@ -35,14 +35,8 @@ func TestNormalizeTrimsOrdersDeduplicatesAndOwnsOutput(t *testing.T) {
|
||||
if !reflect.DeepEqual(result.Value.Scenes, want) {
|
||||
t.Fatalf("scenes = %#v, want %#v", result.Value.Scenes, want)
|
||||
}
|
||||
if got := result.Warnings; len(got) != 7 || !reflect.DeepEqual(
|
||||
[]string{got[0].ReasonCode, got[1].ReasonCode, got[2].ReasonCode, got[3].ReasonCode, got[4].ReasonCode, got[5].ReasonCode, got[6].ReasonCode},
|
||||
[]string{ReasonCodeProseNormalized, ReasonCodeProseNormalized, ReasonCodeProseNormalized, ReasonCodeProseNormalized, ReasonCodeOrderNormalized, ReasonCodeOrderNormalized, ReasonCodeDuplicateCollapsed},
|
||||
) || !reflect.DeepEqual(
|
||||
[]string{got[0].Scope, got[1].Scope, got[2].Scope, got[3].Scope, got[4].Scope, got[5].Scope, got[6].Scope},
|
||||
[]string{"scenes[0]", "scenes[1]", "scenes[2]", "scenes[3]", "scenes[2]", "scenes[0]", "scenes[3]"},
|
||||
) {
|
||||
t.Fatalf("warnings = %#v, want prose, order, then duplicate mutation diagnostics", got)
|
||||
if len(result.Warnings) != 0 || len(result.Diagnostics) != 3 || result.Diagnostics[0].ReasonCode != ReasonCodeProseNormalized || result.Diagnostics[0].OccurrenceCount != 4 || result.Diagnostics[1].ReasonCode != ReasonCodeOrderNormalized || result.Diagnostics[1].OccurrenceCount != 2 || result.Diagnostics[2].ReasonCode != ReasonCodeDuplicateCollapsed || result.Diagnostics[2].OccurrenceCount != 1 {
|
||||
t.Fatalf("diagnostics = %#v, want grouped prose, order, and duplicate observations", result.Diagnostics)
|
||||
}
|
||||
if !reflect.DeepEqual(input, before) {
|
||||
t.Fatalf("Normalize() mutated input: %#v", input)
|
||||
@@ -55,8 +49,8 @@ func TestNormalizeTrimsOrdersDeduplicatesAndOwnsOutput(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("second Normalize() error = %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(second.Value.Scenes, want) || len(second.Warnings) != 0 {
|
||||
t.Fatalf("second normalization = %#v, want unchanged value without warnings", second)
|
||||
if !reflect.DeepEqual(second.Value.Scenes, want) || len(second.Diagnostics) != 0 {
|
||||
t.Fatalf("second normalization = %#v, want unchanged value without diagnostics", second)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +70,8 @@ func TestNormalizeLimitsCombinedSceneMutationWarnings(t *testing.T) {
|
||||
if len(result.Value.Scenes) != count || result.Value.Scenes[0].SourceRef.StartUnitID != 1 {
|
||||
t.Fatalf("normalized scenes = %#v, want unchanged canonical values", result.Value.Scenes)
|
||||
}
|
||||
if len(result.Warnings) != diagnostics.MaxWarnings {
|
||||
t.Fatalf("warning count = %d, want %d", len(result.Warnings), diagnostics.MaxWarnings)
|
||||
}
|
||||
if first := result.Warnings[0]; first.Scope != "scenes[0]" || first.ReasonCode != ReasonCodeProseNormalized {
|
||||
t.Fatalf("first warning = %#v, want first prose warning", first)
|
||||
}
|
||||
summary := result.Warnings[len(result.Warnings)-1]
|
||||
if summary.Scope != "scenes" || summary.ReasonCode != ReasonCodeNormalizationWarningsOmitted || summary.Message != "5 additional warning(s) omitted" {
|
||||
t.Fatalf("warning summary = %#v", summary)
|
||||
if len(result.Warnings) != 0 || len(result.Diagnostics) != 2 || result.Diagnostics[0].ReasonCode != ReasonCodeProseNormalized || result.Diagnostics[0].Disposition != contracts.DiagnosticDispositionObservation || result.Diagnostics[0].OccurrenceCount != count || len(result.Diagnostics[0].Samples) != contracts.MaxDiagnosticSamples || result.Diagnostics[1].ReasonCode != ReasonCodeOrderNormalized || result.Diagnostics[1].OccurrenceCount != count {
|
||||
t.Fatalf("diagnostics = %#v", result.Diagnostics)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user