Files
summercms/modules/tide/report.go
Jakub Zych 5e50b166ef refactor(10.2-01): nest framework packages under modules
- Move remaining beach packages and embedded admin assets\n- Rewrite framework, example, build, and gate paths
2026-09-28 02:21:02 +02:00

54 lines
1.3 KiB
Go

package tide
import (
"fmt"
"strconv"
)
// Coverage is the recorded/passing/failing/unrecorded table over manifest routes.
type Coverage struct {
Total int
Recorded int
Passing int
Failing int
Unrecorded int
Pending int
Ported int
ResumeRemaining int
Rows []CoverageRow
Diffs []string
}
// CoverageRow is one manifest route's outcome.
type CoverageRow struct {
ID string
Status string
Outcome string
}
// CoverageHeaders is the table header for CLI output.
func CoverageHeaders() []string {
return []string{"route", "status", "outcome"}
}
// CoverageRows renders the coverage table.
func (c Coverage) CoverageRows() [][]string {
rows := make([][]string, 0, len(c.Rows))
for _, r := range c.Rows {
rows = append(rows, []string{r.ID, r.Status, r.Outcome})
}
return rows
}
// SummaryLine is a one-line recorded/passing/failing/unrecorded report.
func (c Coverage) SummaryLine() string {
return fmt.Sprintf("recorded %d/%d passing %d failing %d unrecorded %d", c.Recorded, c.Total, c.Passing, c.Failing, c.Unrecorded)
}
func (c Coverage) ResumeLine() string {
if c.ResumeRemaining <= 0 {
return "manifest recording complete"
}
return "resume remaining " + strconv.Itoa(c.ResumeRemaining)
}