diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-29 22:34:47 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-29 22:34:47 +0200 |
| commit | 42fb6efd01e3640ea9d15dc1e0a072c1ea8295b1 (patch) | |
| tree | ebf351b66f0288c8e9f879c529a962b025bebf15 /testx/create.go | |
| parent | 03a31799a872385d821130f46942fc13dae76774 (diff) | |
fix very embarrassing bug where -a didnt actually work
Diffstat (limited to 'testx/create.go')
| -rw-r--r-- | testx/create.go | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/testx/create.go b/testx/create.go deleted file mode 100644 index 24faaed..0000000 --- a/testx/create.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build test - -package testx - -import ( - "github.com/stretchr/testify/assert" - "os/exec" - "pik/identity" - "pik/model" - "pik/runner" - "testing" -) - -func TTarget(name string, sub ...string) model.Target { - t := TestTarget{Id: identity.New(name), MyTags: model.TagsFromFilename(name), SubValue: sub} - return &t -} - -func TSource(name string, targets ...string) *model.Source { - src := &model.Source{ - Path: name, - Identity: identity.New(name), - } - for _, t := range targets { - src.Targets = append(src.Targets, TTarget(t)) - } - return src -} - -func TState(sources ...*model.Source) *model.State { - return &model.State{ - Sources: sources, - } -} - -type TestTarget struct { - runner.Stub - Id identity.Identity - SubValue []string - MyTags model.Tags -} - -func (t TestTarget) Invocation(src *model.Source) []string { - return []string{src.Identity.Reduced, t.Id.Reduced} -} - -func (t TestTarget) Matches(input string) bool { - return t.Id.Is(input) -} - -func (t TestTarget) Visible() bool { - return true -} - -func (t TestTarget) Hydrate(src *model.Source) (model.HydratedTarget, error) { - return runner.HydratedStub{}, nil -} - -func (t TestTarget) Sub() []string { - return t.SubValue -} - -func (t TestTarget) Label() string { - return t.Id.Full -} - -func (t TestTarget) Create(s *model.Source) *exec.Cmd { - panic("whadafak") -} - -func AssertTargetIs(t *testing.T, input string, target model.Target) { - assert.Equal(t, input, target.Label()) -} -func AssertTargetIsNot(t *testing.T, input string, target model.Target) { - assert.NotEqual(t, input, target.Label()) -} -func AssertSourceIs(t *testing.T, input string, src *model.Source) { - assert.NotNil(t, src.Identity) - assert.Equal(t, input, src.Identity.Reduced) -} -func AssertSourceIsNot(t *testing.T, input string, src *model.Source) { - assert.NotNil(t, src.Identity) - assert.NotEqual(t, input, src.Identity.Reduced) -} |
