MCPcopy Index your code
hub / github.com/go-task/task / TestTaskVersion

Function TestTaskVersion

task_test.go:902–935  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

900}
901
902func TestTaskVersion(t *testing.T) {
903 t.Parallel()
904
905 tests := []struct {
906 Dir string
907 Version *semver.Version
908 wantErr bool
909 }{
910 {"testdata/version/v1", semver.MustParse("1"), true},
911 {"testdata/version/v2", semver.MustParse("2"), true},
912 {"testdata/version/v3", semver.MustParse("3"), false},
913 }
914
915 for _, test := range tests {
916 t.Run(test.Dir, func(t *testing.T) {
917 t.Parallel()
918
919 e := task.NewExecutor(
920 task.WithDir(test.Dir),
921 task.WithStdout(io.Discard),
922 task.WithStderr(io.Discard),
923 task.WithVersionCheck(true),
924 )
925 err := e.Setup()
926 if test.wantErr {
927 require.Error(t, err)
928 return
929 }
930 require.NoError(t, err)
931 assert.Equal(t, test.Version, e.Taskfile.Version)
932 assert.Equal(t, 2, e.Taskfile.Tasks.Len())
933 })
934 }
935}
936
937func TestTaskIgnoreErrors(t *testing.T) {
938 t.Parallel()

Callers

nothing calls this directly

Calls 4

SetupMethod · 0.95
RunMethod · 0.45
ErrorMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…