style: gofmt 7 test files
This commit is contained in:
@@ -5,13 +5,16 @@ import (
|
|||||||
"testing"
|
"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) 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) Detect(context.Context) (State, error) { return nil, nil }
|
||||||
func (f fakeModule) Plan(context.Context, State) (Plan, error) { return Plan{}, 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) Apply(context.Context, Plan, Reporter) error { return nil }
|
||||||
func (f fakeModule) Verify(context.Context) error { return nil }
|
func (f fakeModule) Verify(context.Context) error { return nil }
|
||||||
|
|
||||||
func TestRegistry(t *testing.T) {
|
func TestRegistry(t *testing.T) {
|
||||||
t.Run("register then get", func(t *testing.T) {
|
t.Run("register then get", func(t *testing.T) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func (f *fakeRunner) Output(_ context.Context, name string, args ...string) ([]b
|
|||||||
type nop struct{}
|
type nop struct{}
|
||||||
|
|
||||||
func (nop) Progress(string, int, int, string) {}
|
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 {
|
func makeTarGz(t *testing.T, entries map[string][]byte) string {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ var errOne = eo{}
|
|||||||
type nop struct{}
|
type nop struct{}
|
||||||
|
|
||||||
func (nop) Progress(string, int, int, string) {}
|
func (nop) Progress(string, int, int, string) {}
|
||||||
func (nop) Log(string, string) {}
|
func (nop) Log(string, string) {}
|
||||||
|
|
||||||
func TestFontsPlanApplyUsesYay(t *testing.T) {
|
func TestFontsPlanApplyUsesYay(t *testing.T) {
|
||||||
r := &fakeRunner{installed: map[string]bool{"yay": true}}
|
r := &fakeRunner{installed: map[string]bool{"yay": true}}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
type nop struct{}
|
type nop struct{}
|
||||||
|
|
||||||
func (nop) Progress(string, int, int, string) {}
|
func (nop) Progress(string, int, int, string) {}
|
||||||
func (nop) Log(string, string) {}
|
func (nop) Log(string, string) {}
|
||||||
|
|
||||||
func TestThemesCopiesFiles(t *testing.T) {
|
func TestThemesCopiesFiles(t *testing.T) {
|
||||||
src := t.TempDir()
|
src := t.TempDir()
|
||||||
|
|||||||
@@ -14,33 +14,35 @@ import (
|
|||||||
// convergedModule returns an empty Plan — always converged.
|
// convergedModule returns an empty Plan — always converged.
|
||||||
type convergedModule struct{ id string }
|
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) Detect(context.Context) (module.State, error) { return nil, nil }
|
||||||
func (c convergedModule) Plan(context.Context, module.State) (module.Plan, error) {
|
func (c convergedModule) Plan(context.Context, module.State) (module.Plan, error) {
|
||||||
return module.Plan{}, nil
|
return module.Plan{}, nil
|
||||||
}
|
}
|
||||||
func (c convergedModule) Apply(context.Context, module.Plan, module.Reporter) error { return 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 }
|
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) Detect(context.Context) (module.State, error) { return nil, nil }
|
||||||
func (p pendingModule) Plan(context.Context, module.State) (module.Plan, error) {
|
func (p pendingModule) Plan(context.Context, module.State) (module.Plan, error) {
|
||||||
return module.Plan{Actions: []module.Action{{Description: "do a thing"}}}, nil
|
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) 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 }
|
type detectFailModule struct{ id string }
|
||||||
|
|
||||||
func (d detectFailModule) Meta() module.Meta { return module.Meta{ID: d.id} }
|
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) Detect(context.Context) (module.State, error) {
|
||||||
|
return nil, errors.New("boom")
|
||||||
|
}
|
||||||
func (d detectFailModule) Plan(context.Context, module.State) (module.Plan, error) {
|
func (d detectFailModule) Plan(context.Context, module.State) (module.Plan, error) {
|
||||||
return module.Plan{}, nil
|
return module.Plan{}, nil
|
||||||
}
|
}
|
||||||
func (d detectFailModule) Apply(context.Context, module.Plan, module.Reporter) error { return 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.
|
// notFoundRunner simulates "command not found" for version checks.
|
||||||
type notFoundRunner struct{}
|
type notFoundRunner struct{}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func (f fakeModule) Plan(context.Context, module.State) (module.Plan, error) {
|
|||||||
return module.Plan{}, nil
|
return module.Plan{}, nil
|
||||||
}
|
}
|
||||||
func (f fakeModule) Apply(context.Context, module.Plan, module.Reporter) error { return 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) {
|
func TestNewWizardStatePreTicksAllByDefault(t *testing.T) {
|
||||||
reg := module.NewRegistry()
|
reg := module.NewRegistry()
|
||||||
@@ -71,4 +71,3 @@ func TestSelectedIDsOnlyReturnsChecked(t *testing.T) {
|
|||||||
t.Fatalf("got %v", got)
|
t.Fatalf("got %v", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ func TestRenderPlanEmpty(t *testing.T) {
|
|||||||
|
|
||||||
func TestParseIntClamp(t *testing.T) {
|
func TestParseIntClamp(t *testing.T) {
|
||||||
cases := map[string]int{
|
cases := map[string]int{
|
||||||
"": 1,
|
"": 1,
|
||||||
" ": 1,
|
" ": 1,
|
||||||
"abc": 1,
|
"abc": 1,
|
||||||
"3abc": 1, // partial match is rejected (strconv.Atoi, not Sscanf)
|
"3abc": 1, // partial match is rejected (strconv.Atoi, not Sscanf)
|
||||||
"0": 1,
|
"0": 1,
|
||||||
"-5": 1,
|
"-5": 1,
|
||||||
"3": 3,
|
"3": 3,
|
||||||
"12": 12,
|
"12": 12,
|
||||||
"99999999999999999999": 1, // overflow → fallback
|
"99999999999999999999": 1, // overflow → fallback
|
||||||
}
|
}
|
||||||
for in, want := range cases {
|
for in, want := range cases {
|
||||||
|
|||||||
Reference in New Issue
Block a user