MCPcopy
hub / github.com/cli/cli / TestIsURL

Function TestIsURL

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

Source from the content-addressed store, hash-verified

8)
9
10func TestIsURL(t *testing.T) {
11 tests := []struct {
12 name string
13 url string
14 want bool
15 }{
16 {
17 name: "scp-like",
18 url: "git@example.com:owner/repo",
19 want: true,
20 },
21 {
22 name: "scp-like with no user",
23 url: "example.com:owner/repo",
24 want: false,
25 },
26 {
27 name: "ssh",
28 url: "ssh://git@example.com/owner/repo",
29 want: true,
30 },
31 {
32 name: "git",
33 url: "git://example.com/owner/repo",
34 want: true,
35 },
36 {
37 name: "git with extension",
38 url: "git://example.com/owner/repo.git",
39 want: true,
40 },
41 {
42 name: "git+ssh",
43 url: "git+ssh://git@example.com/owner/repo.git",
44 want: true,
45 },
46 {
47 name: "https",
48 url: "https://example.com/owner/repo.git",
49 want: true,
50 },
51 {
52 name: "git+https",
53 url: "git+https://example.com/owner/repo.git",
54 want: true,
55 },
56 {
57 name: "no protocol",
58 url: "example.com/owner/repo",
59 want: false,
60 },
61 }
62 for _, tt := range tests {
63 t.Run(tt.name, func(t *testing.T) {
64 assert.Equal(t, tt.want, IsURL(tt.url))
65 })
66 }
67}

Callers

nothing calls this directly

Calls 3

IsURLFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected