refactor(runner): extract RenderSummary for snapshot testing

This commit is contained in:
pj committed 2026-06-01 21:58:43 +05:30
1 parent f27e66c152
commit e820cff60d
2 files changed
+22 -14

No files matched your search

+2 -14
View File
@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/priyanshujain/sanderling/internal/android"
@@ -166,19 +165,8 @@ func Execute(ctx context.Context, options Options, stdout io.Writer) error {
return fmt.Errorf("runner: %w", err)
}
fmt.Fprintf(stdout, "\nrun complete: %d steps in %s\n", summary.Steps, summary.EndTime.Sub(summary.StartTime).Round(time.Millisecond))
if len(summary.Violations) == 0 {
fmt.Fprintln(stdout, "no violations.")
} else {
fmt.Fprintf(stdout, "%d violation record(s):\n", len(summary.Violations))
for _, violation := range summary.Violations {
fmt.Fprintf(stdout, " step %d: %v\n", violation.StepIndex, violation.Properties)
}
}
if len(summary.UnsupportedVerbs) > 0 {
fmt.Fprintf(stdout, "unsupported on %s: %s\n",
options.Platform, strings.Join(summary.UnsupportedVerbs, ", "))
}
fmt.Fprintf(stdout, "\nelapsed: %s\n", summary.EndTime.Sub(summary.StartTime).Round(time.Millisecond))
runner.RenderSummary(stdout, summary, options.Platform)
return nil
}