(t *testing.T)
| 544 | } |
| 545 | |
| 546 | func TestIsWorkflowSpec(t *testing.T) { |
| 547 | tests := []struct { |
| 548 | name string |
| 549 | path string |
| 550 | want bool |
| 551 | }{ |
| 552 | { |
| 553 | name: "valid workflowspec", |
| 554 | path: "owner/repo/path/to/file.md", |
| 555 | want: true, |
| 556 | }, |
| 557 | { |
| 558 | name: "workflowspec with ref", |
| 559 | path: "owner/repo/workflows/file.md@main", |
| 560 | want: true, |
| 561 | }, |
| 562 | { |
| 563 | name: "workflowspec with section", |
| 564 | path: "owner/repo/workflows/file.md#section", |
| 565 | want: true, |
| 566 | }, |
| 567 | { |
| 568 | name: "workflowspec with ref and section", |
| 569 | path: "owner/repo/workflows/file.md@sha123#section", |
| 570 | want: true, |
| 571 | }, |
| 572 | { |
| 573 | name: "local path with .github", |
| 574 | path: ".github/workflows/file.md", |
| 575 | want: false, |
| 576 | }, |
| 577 | { |
| 578 | name: "relative local path", |
| 579 | path: "../shared/file.md", |
| 580 | want: false, |
| 581 | }, |
| 582 | { |
| 583 | name: "absolute path", |
| 584 | path: "/tmp/gh-aw/gh-aw/file.md", |
| 585 | want: false, |
| 586 | }, |
| 587 | { |
| 588 | name: "too few parts", |
| 589 | path: "owner/repo", |
| 590 | want: false, |
| 591 | }, |
| 592 | { |
| 593 | name: "local path starting with dot", |
| 594 | path: "./file.md", |
| 595 | want: false, |
| 596 | }, |
| 597 | { |
| 598 | name: "shared path with 2 parts", |
| 599 | path: "shared/file.md", |
| 600 | want: false, |
| 601 | }, |
| 602 | { |
| 603 | name: "shared path with 3 parts (mcp subdirectory)", |
nothing calls this directly
no test coverage detected