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

Function TestDry

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

Source from the content-addressed store, hash-verified

974}
975
976func TestDry(t *testing.T) {
977 t.Parallel()
978
979 const dir = "testdata/dry"
980
981 file := filepathext.SmartJoin(dir, "file.txt")
982 _ = os.Remove(file)
983
984 var buff bytes.Buffer
985
986 e := task.NewExecutor(
987 task.WithDir(dir),
988 task.WithStdout(&buff),
989 task.WithStderr(&buff),
990 task.WithDry(true),
991 )
992 require.NoError(t, e.Setup())
993 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build"}))
994
995 assert.Equal(t, "task: [build] touch file.txt", strings.TrimSpace(buff.String()))
996 if _, err := os.Stat(file); err == nil {
997 t.Errorf("File should not exist %s", file)
998 }
999}
1000
1001// TestDryChecksum tests if the checksum file is not being written to disk
1002// if the dry mode is enabled.

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…