style: gofmt 7 test files

This commit is contained in:
MDietermann
2026-04-14 21:30:50 +02:00
parent 137a9b62a5
commit c579375c83
7 changed files with 30 additions and 26 deletions

View File

@@ -5,13 +5,16 @@ import (
"testing"
)
type fakeModule struct{ id string; deps []string }
type fakeModule struct {
id string
deps []string
}
func (f fakeModule) Meta() Meta { return Meta{ID: f.id, Name: f.id, Deps: f.deps} }
func (f fakeModule) Detect(context.Context) (State, error) { return nil, nil }
func (f fakeModule) Plan(context.Context, State) (Plan, error) { return Plan{}, nil }
func (f fakeModule) Apply(context.Context, Plan, Reporter) error { return nil }
func (f fakeModule) Verify(context.Context) error { return nil }
func (f fakeModule) Meta() Meta { return Meta{ID: f.id, Name: f.id, Deps: f.deps} }
func (f fakeModule) Detect(context.Context) (State, error) { return nil, nil }
func (f fakeModule) Plan(context.Context, State) (Plan, error) { return Plan{}, nil }
func (f fakeModule) Apply(context.Context, Plan, Reporter) error { return nil }
func (f fakeModule) Verify(context.Context) error { return nil }
func TestRegistry(t *testing.T) {
t.Run("register then get", func(t *testing.T) {

View File

@@ -36,7 +36,7 @@ func (f *fakeRunner) Output(_ context.Context, name string, args ...string) ([]b
type nop struct{}
func (nop) Progress(string, int, int, string) {}
func (nop) Log(string, string) {}
func (nop) Log(string, string) {}
func makeTarGz(t *testing.T, entries map[string][]byte) string {
t.Helper()

View File

@@ -38,7 +38,7 @@ var errOne = eo{}
type nop struct{}
func (nop) Progress(string, int, int, string) {}
func (nop) Log(string, string) {}
func (nop) Log(string, string) {}
func TestFontsPlanApplyUsesYay(t *testing.T) {
r := &fakeRunner{installed: map[string]bool{"yay": true}}

View File

@@ -13,7 +13,7 @@ import (
type nop struct{}
func (nop) Progress(string, int, int, string) {}
func (nop) Log(string, string) {}
func (nop) Log(string, string) {}
func TestThemesCopiesFiles(t *testing.T) {
src := t.TempDir()

View File

@@ -14,33 +14,35 @@ import (
// convergedModule returns an empty Plan — always converged.
type convergedModule struct{ id string }
func (c convergedModule) Meta() module.Meta { return module.Meta{ID: c.id, Name: c.id} }
func (c convergedModule) Meta() module.Meta { return module.Meta{ID: c.id, Name: c.id} }
func (c convergedModule) Detect(context.Context) (module.State, error) { return nil, nil }
func (c convergedModule) Plan(context.Context, module.State) (module.Plan, error) {
return module.Plan{}, nil
}
func (c convergedModule) Apply(context.Context, module.Plan, module.Reporter) error { return nil }
func (c convergedModule) Verify(context.Context) error { return nil }
func (c convergedModule) Verify(context.Context) error { return nil }
type pendingModule struct{ id string }
func (p pendingModule) Meta() module.Meta { return module.Meta{ID: p.id} }
func (p pendingModule) Meta() module.Meta { return module.Meta{ID: p.id} }
func (p pendingModule) Detect(context.Context) (module.State, error) { return nil, nil }
func (p pendingModule) Plan(context.Context, module.State) (module.Plan, error) {
return module.Plan{Actions: []module.Action{{Description: "do a thing"}}}, nil
}
func (p pendingModule) Apply(context.Context, module.Plan, module.Reporter) error { return nil }
func (p pendingModule) Verify(context.Context) error { return nil }
func (p pendingModule) Verify(context.Context) error { return nil }
type detectFailModule struct{ id string }
func (d detectFailModule) Meta() module.Meta { return module.Meta{ID: d.id} }
func (d detectFailModule) Detect(context.Context) (module.State, error) { return nil, errors.New("boom") }
func (d detectFailModule) Meta() module.Meta { return module.Meta{ID: d.id} }
func (d detectFailModule) Detect(context.Context) (module.State, error) {
return nil, errors.New("boom")
}
func (d detectFailModule) Plan(context.Context, module.State) (module.Plan, error) {
return module.Plan{}, nil
}
func (d detectFailModule) Apply(context.Context, module.Plan, module.Reporter) error { return nil }
func (d detectFailModule) Verify(context.Context) error { return nil }
func (d detectFailModule) Verify(context.Context) error { return nil }
// notFoundRunner simulates "command not found" for version checks.
type notFoundRunner struct{}

View File

@@ -19,7 +19,7 @@ func (f fakeModule) Plan(context.Context, module.State) (module.Plan, error) {
return module.Plan{}, nil
}
func (f fakeModule) Apply(context.Context, module.Plan, module.Reporter) error { return nil }
func (f fakeModule) Verify(context.Context) error { return nil }
func (f fakeModule) Verify(context.Context) error { return nil }
func TestNewWizardStatePreTicksAllByDefault(t *testing.T) {
reg := module.NewRegistry()
@@ -71,4 +71,3 @@ func TestSelectedIDsOnlyReturnsChecked(t *testing.T) {
t.Fatalf("got %v", got)
}
}

View File

@@ -45,14 +45,14 @@ func TestRenderPlanEmpty(t *testing.T) {
func TestParseIntClamp(t *testing.T) {
cases := map[string]int{
"": 1,
" ": 1,
"abc": 1,
"3abc": 1, // partial match is rejected (strconv.Atoi, not Sscanf)
"0": 1,
"-5": 1,
"3": 3,
"12": 12,
"": 1,
" ": 1,
"abc": 1,
"3abc": 1, // partial match is rejected (strconv.Atoi, not Sscanf)
"0": 1,
"-5": 1,
"3": 3,
"12": 12,
"99999999999999999999": 1, // overflow → fallback
}
for in, want := range cases {