MCPcopy Create free account
hub / github.com/go-task/task / TestSummary

Function TestSummary

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

Source from the content-addressed store, hash-verified

1776}
1777
1778func TestSummary(t *testing.T) {
1779 t.Parallel()
1780
1781 const dir = "testdata/summary"
1782
1783 var buff bytes.Buffer
1784 e := task.NewExecutor(
1785 task.WithDir(dir),
1786 task.WithStdout(&buff),
1787 task.WithStderr(&buff),
1788 task.WithSummary(true),
1789 task.WithSilent(true),
1790 )
1791 require.NoError(t, e.Setup())
1792 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "task-with-summary"}, &task.Call{Task: "other-task-with-summary"}))
1793
1794 data, err := os.ReadFile(filepathext.SmartJoin(dir, "task-with-summary.txt"))
1795 require.NoError(t, err)
1796
1797 expectedOutput := string(data)
1798 if runtime.GOOS == "windows" {
1799 expectedOutput = strings.ReplaceAll(expectedOutput, "\r\n", "\n")
1800 }
1801
1802 assert.Equal(t, expectedOutput, buff.String())
1803}
1804
1805func TestWhenNoDirAttributeItRunsInSameDirAsTaskfile(t *testing.T) {
1806 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…