(t *testing.T)
| 549 | } |
| 550 | |
| 551 | func TestParseDiffResult(t *testing.T) { |
| 552 | tests := []struct { |
| 553 | name string |
| 554 | diff string |
| 555 | completed []string |
| 556 | added []string |
| 557 | started []string |
| 558 | blocked []string |
| 559 | cancelled []string |
| 560 | }{ |
| 561 | { |
| 562 | name: "single completed file", |
| 563 | diff: "+++ b/tasks/cli/042.md\n@@ -4 +4 @@\n-status: pending\n+status: completed\n", |
| 564 | completed: []string{"tasks/cli/042.md"}, |
| 565 | }, |
| 566 | { |
| 567 | name: "multiple completed files", |
| 568 | diff: "+++ b/a.md\n+status: completed\n+++ b/b.md\n+status: completed\n", |
| 569 | completed: []string{"a.md", "b.md"}, |
| 570 | }, |
| 571 | { |
| 572 | name: "in-progress status change", |
| 573 | diff: "--- a/a.md\n+++ b/a.md\n+status: in-progress\n", |
| 574 | started: []string{"a.md"}, |
| 575 | }, |
| 576 | { |
| 577 | name: "new pending file", |
| 578 | diff: "--- /dev/null\n+++ b/tasks/cli/045.md\n+status: pending\n", |
| 579 | added: []string{"tasks/cli/045.md"}, |
| 580 | }, |
| 581 | { |
| 582 | name: "modified pending file ignored", |
| 583 | diff: "--- a/tasks/cli/045.md\n+++ b/tasks/cli/045.md\n+status: pending\n", |
| 584 | }, |
| 585 | { |
| 586 | name: "blocked status change", |
| 587 | diff: "--- a/a.md\n+++ b/a.md\n+status: blocked\n", |
| 588 | blocked: []string{"a.md"}, |
| 589 | }, |
| 590 | { |
| 591 | name: "cancelled status change", |
| 592 | diff: "--- a/a.md\n+++ b/a.md\n+status: cancelled\n", |
| 593 | cancelled: []string{"a.md"}, |
| 594 | }, |
| 595 | { |
| 596 | name: "empty diff", |
| 597 | diff: "", |
| 598 | }, |
| 599 | { |
| 600 | name: "no status line", |
| 601 | diff: "+++ b/a.md\n+title: something\n", |
| 602 | }, |
| 603 | { |
| 604 | name: "mixed new and modified files", |
| 605 | diff: "--- /dev/null\n+++ b/new.md\n+status: pending\n--- a/old.md\n+++ b/old.md\n+status: pending\n", |
| 606 | added: []string{"new.md"}, |
| 607 | }, |
| 608 | { |
nothing calls this directly
no test coverage detected