| 312 | } |
| 313 | |
| 314 | func 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 | |
| 349 | func TestResolve_NonExistentFiles(t *testing.T) { |
| 350 | root := t.TempDir() |