MCPcopy Create free account
hub / github.com/driangle/taskmd / createProjectWithTasks

Function createProjectWithTasks

apps/cli/internal/cli/projects_test.go:36–58  ·  view source on GitHub ↗

createProjectWithTasks creates a project directory with .taskmd.yaml and task files.

(t *testing.T, taskDir string, tasks map[string]string)

Source from the content-addressed store, hash-verified

34
35// createProjectWithTasks creates a project directory with .taskmd.yaml and task files.
36func createProjectWithTasks(t *testing.T, taskDir string, tasks map[string]string) string {
37 t.Helper()
38 projectDir := t.TempDir()
39
40 tasksPath := filepath.Join(projectDir, taskDir)
41 if err := os.MkdirAll(tasksPath, 0755); err != nil {
42 t.Fatalf("failed to create tasks dir: %v", err)
43 }
44
45 // Write .taskmd.yaml pointing to the task directory
46 configContent := "task-dir: " + taskDir + "\n"
47 if err := os.WriteFile(filepath.Join(projectDir, ".taskmd.yaml"), []byte(configContent), 0644); err != nil {
48 t.Fatalf("failed to write .taskmd.yaml: %v", err)
49 }
50
51 for filename, content := range tasks {
52 if err := os.WriteFile(filepath.Join(tasksPath, filename), []byte(content), 0644); err != nil {
53 t.Fatalf("failed to create task file %s: %v", filename, err)
54 }
55 }
56
57 return projectDir
58}
59
60func captureProjectsOutput(t *testing.T) (string, string, error) {
61 t.Helper()

Calls

no outgoing calls

Tested by

no test coverage detected