Add structured validation failures

This commit is contained in:
2026-10-07 18:27:36 +00:00
parent 1de7555b3e
commit 136a97fb6c
6 changed files with 162 additions and 5 deletions

View File

@@ -9,6 +9,8 @@ import (
"path/filepath"
"strings"
"testing"
"gitea.maximumdirect.net/eric/ReleaseKit/internal/validation"
)
const testVersion = "v1.2.3"
@@ -123,6 +125,14 @@ func TestDefaultValidationDoesNotInheritGOFLAGSRunFilter(t *testing.T) {
if err == nil || !strings.Contains(output.String(), "TestExpectedFailure") {
t.Fatalf("Check() error = %v, output = %q; wanted the failing standard test to run", err, output.String())
}
var failure *validation.Failure
if !errors.As(err, &failure) || failure.Check != validation.GoTest {
t.Fatalf("Check() error = %v; want a go-test validation failure", err)
}
var exitErr *exec.ExitError
if !errors.As(err, &exitErr) {
t.Fatalf("Check() error = %v; want the Go process exit error preserved", err)
}
})
}
}