diff --git a/modules/mesh-delivery-checker/internal/check/failure_words_test.go b/modules/mesh-delivery-checker/internal/check/failure_words_test.go index 9334b9d..ef95b47 100644 --- a/modules/mesh-delivery-checker/internal/check/failure_words_test.go +++ b/modules/mesh-delivery-checker/internal/check/failure_words_test.go @@ -1,6 +1,7 @@ package check import ( + "encoding/json" "strings" "testing" @@ -54,3 +55,19 @@ func TestWordsLongerThanTheBoundKeepTheirLastLines(t *testing.T) { // 1901/AC1 } _ = delivery.VerdictFail } + +// An older build module sends no "cause": its answer is still accepted and the verdict's words are its output, as before. +func TestAnOlderBuildModulesFailureIsAcceptedWithItsWholeOutput(t *testing.T) { // 1901/AC3 + old := `{"package":"p","test":"TestX","output":"x_test.go:1: logged\nx_test.go:2: the old kept lines"}` + var f Failure + if err := json.Unmarshal([]byte(old), &f); err != nil || f.Cause != "" { + t.Fatalf("1901/AC3: err = %v, cause = %q", err, f.Cause) + } + v := levelFailure(&target{}, "unit", Tested{Failed: []Failure{f}}) + if v.Failed.Words != "x_test.go:1: logged\nx_test.go:2: the old kept lines" { + t.Errorf("1901/AC3: words = %q", v.Failed.Words) + } + if got := firstFailed(*v); !strings.Contains(got, "logged") || strings.Contains(got, "\n") { + t.Errorf("1901/AC3: status = %q", got) + } +}