From c579375c830762830ac94abd87af99716ead9c6d Mon Sep 17 00:00:00 2001 From: MDietermann Date: Tue, 14 Apr 2026 21:30:50 +0200 Subject: [PATCH] style: gofmt 7 test files --- internal/module/registry_test.go | 15 +++++++++------ internal/modules/arduinocli/arduinocli_test.go | 2 +- internal/modules/fonts/fonts_test.go | 2 +- internal/modules/themes/themes_test.go | 2 +- internal/subcommands/doctor/doctor_test.go | 16 +++++++++------- internal/tui/state_test.go | 3 +-- internal/tui/wizard/wizard_test.go | 16 ++++++++-------- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/internal/module/registry_test.go b/internal/module/registry_test.go index 3536051..0aa0d6c 100644 --- a/internal/module/registry_test.go +++ b/internal/module/registry_test.go @@ -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) { diff --git a/internal/modules/arduinocli/arduinocli_test.go b/internal/modules/arduinocli/arduinocli_test.go index 7abd45e..90dbec3 100644 --- a/internal/modules/arduinocli/arduinocli_test.go +++ b/internal/modules/arduinocli/arduinocli_test.go @@ -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() diff --git a/internal/modules/fonts/fonts_test.go b/internal/modules/fonts/fonts_test.go index fe16fc8..78761af 100644 --- a/internal/modules/fonts/fonts_test.go +++ b/internal/modules/fonts/fonts_test.go @@ -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}} diff --git a/internal/modules/themes/themes_test.go b/internal/modules/themes/themes_test.go index c228518..d5a7e2c 100644 --- a/internal/modules/themes/themes_test.go +++ b/internal/modules/themes/themes_test.go @@ -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() diff --git a/internal/subcommands/doctor/doctor_test.go b/internal/subcommands/doctor/doctor_test.go index 419e81f..8851394 100644 --- a/internal/subcommands/doctor/doctor_test.go +++ b/internal/subcommands/doctor/doctor_test.go @@ -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{} diff --git a/internal/tui/state_test.go b/internal/tui/state_test.go index 42c9789..6593311 100644 --- a/internal/tui/state_test.go +++ b/internal/tui/state_test.go @@ -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) } } - diff --git a/internal/tui/wizard/wizard_test.go b/internal/tui/wizard/wizard_test.go index 1e788f6..6898b4e 100644 --- a/internal/tui/wizard/wizard_test.go +++ b/internal/tui/wizard/wizard_test.go @@ -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 {