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

Function TestResolve_IncludeContent

apps/cli/internal/taskcontext/resolve_test.go:314–347  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

312}
313
314func TestResolve_IncludeContent(t *testing.T) {
315 root := t.TempDir()
316 writeFile(t, root, "src/main.go", "package main\n\nfunc main() {}\n")
317
318 task := &model.Task{
319 ID: "006",
320 Title: "Content task",
321 Body: "## Description\n\nSome task body.",
322 Context: []string{"src/main.go"},
323 }
324
325 result, err := Resolve(task, Options{
326 ProjectRoot: root,
327 IncludeContent: true,
328 })
329 if err != nil {
330 t.Fatalf("unexpected error: %v", err)
331 }
332
333 if result.TaskBody != "## Description\n\nSome task body." {
334 t.Errorf("unexpected task body: %q", result.TaskBody)
335 }
336
337 if len(result.Files) != 1 {
338 t.Fatalf("expected 1 file, got %d", len(result.Files))
339 }
340 f := result.Files[0]
341 if f.Content != "package main\n\nfunc main() {}\n" {
342 t.Errorf("unexpected content: %q", f.Content)
343 }
344 if f.Lines != 3 {
345 t.Errorf("expected 3 lines, got %d", f.Lines)
346 }
347}
348
349func TestResolve_NonExistentFiles(t *testing.T) {
350 root := t.TempDir()

Callers

nothing calls this directly

Calls 2

writeFileFunction · 0.70
ResolveFunction · 0.70

Tested by

no test coverage detected