(t *testing.T)
| 19 | import "testing" |
| 20 | |
| 21 | func TestParseModuleCommit(t *testing.T) { |
| 22 | for i, tc := range []struct { |
| 23 | str string |
| 24 | commit string |
| 25 | isSha bool |
| 26 | }{ |
| 27 | {"v16.2.1+incompatible", "v16.2.1", false}, |
| 28 | {"v0.0.0-20171204204709-577dee27f20d", "577dee27f20d", true}, |
| 29 | {"v1.0.0", "v1.0.0", false}, |
| 30 | {"v1.0.0-rc1", "v1.0.0-rc1", false}, |
| 31 | {"v0.4.15-0.20190919025122-fc70bd9a86b5", "fc70bd9a86b5", true}, |
| 32 | } { |
| 33 | commit, isSha := getCommitOrVersion(tc.str) |
| 34 | if commit != tc.commit { |
| 35 | t.Fatalf("[%d] unexpected commit %q, expected %q", i, commit, tc.commit) |
| 36 | } |
| 37 | if isSha != tc.isSha { |
| 38 | t.Fatalf("[%d] unexpected sha %t, expected %t", i, isSha, tc.isSha) |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestGetGitURL(t *testing.T) { |
| 45 | for _, tc := range []struct { |
nothing calls this directly
no test coverage detected