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

Function TestUserWorkingDirectory

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

Source from the content-addressed store, hash-verified

2609}
2610
2611func TestUserWorkingDirectory(t *testing.T) {
2612 t.Parallel()
2613
2614 var buff bytes.Buffer
2615 e := task.NewExecutor(
2616 task.WithDir("testdata/user_working_dir"),
2617 task.WithStdout(&buff),
2618 task.WithStderr(&buff),
2619 )
2620 wd, err := os.Getwd()
2621 require.NoError(t, err)
2622 require.NoError(t, e.Setup())
2623 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "default"}))
2624 // Use filepath.ToSlash because USER_WORKING_DIR uses forward slashes on all platforms
2625 assert.Equal(t, fmt.Sprintf("%s\n", filepath.ToSlash(wd)), buff.String())
2626}
2627
2628func TestUserWorkingDirectoryWithIncluded(t *testing.T) {
2629 t.Parallel()

Callers

nothing calls this directly

Calls 3

SetupMethod · 0.95
RunMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…