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

Function TestUserWorkingDirectoryWithIncluded

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

Source from the content-addressed store, hash-verified

2626}
2627
2628func TestUserWorkingDirectoryWithIncluded(t *testing.T) {
2629 t.Parallel()
2630
2631 wd, err := os.Getwd()
2632 require.NoError(t, err)
2633
2634 wd = filepath.ToSlash(filepathext.SmartJoin(wd, "testdata/user_working_dir_with_includes/somedir"))
2635
2636 var buff bytes.Buffer
2637 e := task.NewExecutor(
2638 task.WithDir("testdata/user_working_dir_with_includes"),
2639 task.WithStdout(&buff),
2640 task.WithStderr(&buff),
2641 )
2642 e.UserWorkingDir = wd
2643
2644 require.NoError(t, err)
2645 require.NoError(t, e.Setup())
2646 require.NoError(t, e.Run(t.Context(), &task.Call{Task: "included:echo"}))
2647 // Normalize path separators for cross-platform compatibility (Windows uses backslashes)
2648 assert.Equal(t, fmt.Sprintf("%s\n", wd), normalizePathSeparators(buff.String()))
2649}
2650
2651func TestPlatforms(t *testing.T) {
2652 t.Parallel()

Callers

nothing calls this directly

Calls 5

SetupMethod · 0.95
RunMethod · 0.95
SmartJoinFunction · 0.92
normalizePathSeparatorsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…