MCPcopy
hub / github.com/lxc/incus / TestHost

Function TestHost

shared/api/url_test.go:34–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestHost(t *testing.T) {
35 tests := []struct {
36 name string
37 host string
38 expected string
39 }{
40 {"simple host", "example.com", "example.com"},
41 {"host with port", "example.com:8080", "example.com:8080"},
42 {"empty host", "", ""},
43 {"IP address", "192.168.1.1", "192.168.1.1"},
44 }
45
46 for _, tt := range tests {
47 t.Run(tt.name, func(t *testing.T) {
48 u := NewURL().Host(tt.host)
49 if u.URL.Host != tt.expected {
50 t.Errorf("Expected host %q, got %q", tt.expected, u.URL.Host)
51 }
52 })
53 }
54}
55
56func TestPath(t *testing.T) {
57 tests := []struct {

Callers

nothing calls this directly

Calls 4

NewURLFunction · 0.85
HostMethod · 0.80
ErrorfMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…