(c *C)
| 43 | } |
| 44 | |
| 45 | func (s *URLSuite) TestFindScpLikeComponents(c *C) { |
| 46 | testCases := []struct { |
| 47 | url, user, host, port, path string |
| 48 | }{ |
| 49 | { |
| 50 | // Most-extended case |
| 51 | url: "git@github.com:james/bond", user: "git", host: "github.com", port: "", path: "james/bond", |
| 52 | }, |
| 53 | { |
| 54 | // Most-extended case with port |
| 55 | url: "git@github.com:22:james/bond", user: "git", host: "github.com", port: "22", path: "james/bond", |
| 56 | }, |
| 57 | { |
| 58 | // Most-extended case with numeric path |
| 59 | url: "git@github.com:007/bond", user: "git", host: "github.com", port: "", path: "007/bond", |
| 60 | }, |
| 61 | { |
| 62 | // Most-extended case with port and numeric path |
| 63 | url: "git@github.com:22:007/bond", user: "git", host: "github.com", port: "22", path: "007/bond", |
| 64 | }, |
| 65 | { |
| 66 | // Single repo path |
| 67 | url: "git@github.com:bond", user: "git", host: "github.com", port: "", path: "bond", |
| 68 | }, |
| 69 | { |
| 70 | // Single repo path with port |
| 71 | url: "git@github.com:22:bond", user: "git", host: "github.com", port: "22", path: "bond", |
| 72 | }, |
| 73 | { |
| 74 | // Single repo path with port and numeric path |
| 75 | url: "git@github.com:22:007", user: "git", host: "github.com", port: "22", path: "007", |
| 76 | }, |
| 77 | { |
| 78 | // Repo path ending with .git and starting with _ |
| 79 | url: "git@github.com:22:_007.git", user: "git", host: "github.com", port: "22", path: "_007.git", |
| 80 | }, |
| 81 | { |
| 82 | // Repo path ending with .git and starting with _ |
| 83 | url: "git@github.com:_007.git", user: "git", host: "github.com", port: "", path: "_007.git", |
| 84 | }, |
| 85 | { |
| 86 | // Repo path ending with .git and starting with _ |
| 87 | url: "git@github.com:_james.git", user: "git", host: "github.com", port: "", path: "_james.git", |
| 88 | }, |
| 89 | { |
| 90 | // Repo path ending with .git and starting with _ |
| 91 | url: "git@github.com:_james/bond.git", user: "git", host: "github.com", port: "", path: "_james/bond.git", |
| 92 | }, |
| 93 | } |
| 94 | |
| 95 | for _, tc := range testCases { |
| 96 | user, host, port, path := FindScpLikeComponents(tc.url) |
| 97 | |
| 98 | logf := func(ok bool) { |
| 99 | if ok { |
| 100 | return |
| 101 | } |
| 102 | c.Logf("%q check failed", tc.url) |
nothing calls this directly
no test coverage detected