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

Function TestCmdsVariables

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

Source from the content-addressed store, hash-verified

849}
850
851func TestCmdsVariables(t *testing.T) {
852 t.Parallel()
853
854 const dir = "testdata/cmds_vars"
855
856 _ = os.RemoveAll(filepathext.SmartJoin(dir, ".task"))
857
858 var buff bytes.Buffer
859 e := task.NewExecutor(
860 task.WithDir(dir),
861 task.WithTempDir(task.TempDir{
862 Remote: filepathext.SmartJoin(dir, ".task"),
863 Fingerprint: filepathext.SmartJoin(dir, ".task"),
864 }),
865 task.WithStdout(&buff),
866 task.WithStderr(&buff),
867 task.WithSilent(false),
868 task.WithVerbose(true),
869 )
870 require.NoError(t, e.Setup())
871 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build-checksum"}))
872
873 assert.Contains(t, buff.String(), "3e464c4b03f4b65d740e1e130d4d108a")
874
875 buff.Reset()
876 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build-ts"}))
877 inf, err := os.Stat(filepathext.SmartJoin(dir, "source.txt"))
878 require.NoError(t, err)
879 ts := fmt.Sprintf("%d", inf.ModTime().Unix())
880 tf := inf.ModTime().String()
881
882 assert.Contains(t, buff.String(), ts)
883 assert.Contains(t, buff.String(), tf)
884}
885
886func TestCyclicDep(t *testing.T) {
887 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…