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

Function TestTaskfileWalk

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

Source from the content-addressed store, hash-verified

2570}
2571
2572func TestTaskfileWalk(t *testing.T) {
2573 t.Parallel()
2574
2575 tests := []struct {
2576 name string
2577 dir string
2578 expected string
2579 }{
2580 {
2581 name: "walk from root directory",
2582 dir: "testdata/taskfile_walk",
2583 expected: "foo\n",
2584 }, {
2585 name: "walk from sub directory",
2586 dir: "testdata/taskfile_walk/foo",
2587 expected: "foo\n",
2588 }, {
2589 name: "walk from sub sub directory",
2590 dir: "testdata/taskfile_walk/foo/bar",
2591 expected: "foo\n",
2592 },
2593 }
2594 for _, test := range tests {
2595 t.Run(test.name, func(t *testing.T) {
2596 t.Parallel()
2597
2598 var buff bytes.Buffer
2599 e := task.NewExecutor(
2600 task.WithDir(test.dir),
2601 task.WithStdout(&buff),
2602 task.WithStderr(&buff),
2603 )
2604 require.NoError(t, e.Setup())
2605 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "default"}))
2606 assert.Equal(t, test.expected, buff.String())
2607 })
2608 }
2609}
2610
2611func TestUserWorkingDirectory(t *testing.T) {
2612 t.Parallel()

Callers

nothing calls this directly

Calls 4

SetupMethod · 0.95
RunMethod · 0.95
RunMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…