TestFetchRefToRefspec verifies the refspec expansion logic.
(t *testing.T)
| 873 | |
| 874 | // TestFetchRefToRefspec verifies the refspec expansion logic. |
| 875 | func TestFetchRefToRefspec(t *testing.T) { |
| 876 | tests := []struct { |
| 877 | pattern string |
| 878 | expected string |
| 879 | }{ |
| 880 | {"*", "+refs/heads/*:refs/remotes/origin/*"}, |
| 881 | {"refs/pulls/open/*", "+refs/pull/*/head:refs/remotes/origin/pull/*/head"}, |
| 882 | {"main", "+refs/heads/main:refs/remotes/origin/main"}, |
| 883 | {"feature/my-branch", "+refs/heads/feature/my-branch:refs/remotes/origin/feature/my-branch"}, |
| 884 | {"feature/*", "+refs/heads/feature/*:refs/remotes/origin/feature/*"}, |
| 885 | } |
| 886 | for _, tt := range tests { |
| 887 | t.Run(tt.pattern, func(t *testing.T) { |
| 888 | got := fetchRefToRefspec(tt.pattern) |
| 889 | assert.Equal(t, tt.expected, got, "refspec should match expected value") |
| 890 | }) |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | // TestMergeFetchRefs verifies that fetch ref lists are properly unioned. |
| 895 | func TestMergeFetchRefs(t *testing.T) { |
nothing calls this directly
no test coverage detected