From a697ee86d4afc27ce54bb176c7b9bea8f1c45ad7 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 23 Oct 2026 22:14:29 +0200 Subject: [PATCH] Test 1901/AC3: an older pair of build module and checker still agree (issue 1901) --- .../internal/check/failure_words_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) + } +}