MCPcopy Create free account
hub / github.com/cli/cli / TestParseURL

Function TestParseURL

git/url_test.go:71–240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestParseURL(t *testing.T) {
72 type url struct {
73 Scheme string
74 User string
75 Host string
76 Path string
77 }
78 tests := []struct {
79 name string
80 url string
81 want url
82 }{
83 {
84 name: "HTTPS",
85 url: "https://example.com/owner/repo.git",
86 want: url{
87 Scheme: "https",
88 User: "",
89 Host: "example.com",
90 Path: "/owner/repo.git",
91 },
92 },
93 {
94 name: "HTTP",
95 url: "http://example.com/owner/repo.git",
96 want: url{
97 Scheme: "http",
98 User: "",
99 Host: "example.com",
100 Path: "/owner/repo.git",
101 },
102 },
103 {
104 name: "git",
105 url: "git://example.com/owner/repo.git",
106 want: url{
107 Scheme: "git",
108 User: "",
109 Host: "example.com",
110 Path: "/owner/repo.git",
111 },
112 },
113 {
114 name: "ssh",
115 url: "ssh://git@example.com/owner/repo.git",
116 want: url{
117 Scheme: "ssh",
118 User: "git",
119 Host: "example.com",
120 Path: "/owner/repo.git",
121 },
122 },
123 {
124 name: "ssh with port",
125 url: "ssh://git@example.com:443/owner/repo.git",
126 want: url{
127 Scheme: "ssh",
128 User: "git",

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.80
ParseURLFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected