Test 1901/AC3: an older pair of build module and checker still agree (issue 1901)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -54,3 +55,19 @@ func TestWordsLongerThanTheBoundKeepTheirLastLines(t *testing.T) { // 1901/AC1
|
|||||||
}
|
}
|
||||||
_ = delivery.VerdictFail
|
_ = 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user