(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestSourceIsGit(t *testing.T) { |
| 119 | tests := []struct { |
| 120 | name string |
| 121 | src string |
| 122 | expected bool |
| 123 | }{ |
| 124 | // Git URLs that should be detected |
| 125 | { |
| 126 | name: "git protocol with https url is detected as git", |
| 127 | src: "git::https://foo.bar/asdf", |
| 128 | expected: true, |
| 129 | }, |
| 130 | { |
| 131 | name: "git protocol with github repository is detected as git", |
| 132 | src: "git::github.com/foo/bar", |
| 133 | expected: true, |
| 134 | }, |
| 135 | { |
| 136 | name: "github repository path is detected as git", |
| 137 | src: "github.com/foo/bar", |
| 138 | expected: true, |
| 139 | }, |
| 140 | { |
| 141 | name: "gitlab repository path is detected as git", |
| 142 | src: "gitlab.com/foo/bar", |
| 143 | expected: true, |
| 144 | }, |
| 145 | { |
| 146 | name: "bitbucket repository path is detected as git", |
| 147 | src: "bitbucket.org/user/repo", |
| 148 | expected: true, |
| 149 | }, |
| 150 | { |
| 151 | name: "git ssh url is detected as git", |
| 152 | src: "git@github.com:user/repo.git", |
| 153 | expected: true, |
| 154 | }, |
| 155 | |
| 156 | // Non-Git URLs that should not be detected |
| 157 | { |
| 158 | name: "https raw url is not detected as git", |
| 159 | src: "https://raw.githubusercontent.com/foo/bar", |
| 160 | expected: false, |
| 161 | }, |
| 162 | { |
| 163 | name: "s3 protocol url is not detected as git", |
| 164 | src: "s3::github.com/foo/bar", |
| 165 | expected: false, |
| 166 | }, |
| 167 | { |
| 168 | name: "https regular url is not detected as git", |
| 169 | src: "https://example.com/file.yaml", |
| 170 | expected: false, |
| 171 | }, |
| 172 | |
| 173 | // Edge cases |
| 174 | { |
| 175 | name: "empty string is not detected as git", |
nothing calls this directly
no test coverage detected