MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestFormatRemotePath_Table

Function TestFormatRemotePath_Table

pkg/control/path_test.go:197–219  ·  view source on GitHub ↗

Table-driven test for formatRemotePath

(t *testing.T)

Source from the content-addressed store, hash-verified

195
196// Table-driven test for formatRemotePath
197func TestFormatRemotePath_Table(t *testing.T) {
198 tests := []struct {
199 name string
200 host string
201 path string
202 expected string
203 }{
204 {"plain IPv4", "10.0.0.1", "/tmp", "10.0.0.1:/tmp"},
205 {"IPv6 loopback", "::1", "/tmp", "[::1]:/tmp"},
206 {"IPv6 full", "2001:db8::1", "/data", "[2001:db8::1]:/data"},
207 {"domain", "example.com", "/file", "example.com:/file"},
208 {"empty host", "", "/path", ":/path"},
209 {"empty path", "host", "", "host:"},
210 {"host with zone", "fe80::1%en0", "/home", "[fe80::1%en0]:/home"},
211 }
212
213 for _, tt := range tests {
214 t.Run(tt.name, func(t *testing.T) {
215 result := formatRemotePath(tt.host, tt.path)
216 assert.Equal(t, tt.expected, result)
217 })
218 }
219}

Callers

nothing calls this directly

Calls 1

formatRemotePathFunction · 0.85

Tested by

no test coverage detected