MCPcopy
hub / github.com/go-task/task / TestStatusVariables

Function TestStatusVariables

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

Source from the content-addressed store, hash-verified

812}
813
814func TestStatusVariables(t *testing.T) {
815 t.Parallel()
816
817 const dir = "testdata/status_vars"
818
819 _ = os.RemoveAll(filepathext.SmartJoin(dir, ".task"))
820 _ = os.Remove(filepathext.SmartJoin(dir, "generated.txt"))
821
822 var buff bytes.Buffer
823 e := task.NewExecutor(
824 task.WithDir(dir),
825 task.WithTempDir(task.TempDir{
826 Remote: filepathext.SmartJoin(dir, ".task"),
827 Fingerprint: filepathext.SmartJoin(dir, ".task"),
828 }),
829 task.WithStdout(&buff),
830 task.WithStderr(&buff),
831 task.WithSilent(false),
832 task.WithVerbose(true),
833 )
834 require.NoError(t, e.Setup())
835 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build-checksum"}))
836
837 assert.Contains(t, buff.String(), "3e464c4b03f4b65d740e1e130d4d108a")
838
839 buff.Reset()
840 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build-ts"}))
841
842 inf, err := os.Stat(filepathext.SmartJoin(dir, "source.txt"))
843 require.NoError(t, err)
844 ts := fmt.Sprintf("%d", inf.ModTime().Unix())
845 tf := inf.ModTime().String()
846
847 assert.Contains(t, buff.String(), ts)
848 assert.Contains(t, buff.String(), tf)
849}
850
851func TestCmdsVariables(t *testing.T) {
852 t.Parallel()

Callers

nothing calls this directly

Calls 4

SetupMethod · 0.95
RunMethod · 0.95
SmartJoinFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…