MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestParseURI_WSHCurrentPath

Function TestParseURI_WSHCurrentPath

pkg/remote/connparse/connparse_test.go:194–260  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

192}
193
194func TestParseURI_WSHCurrentPath(t *testing.T) {
195 cstr := "./Documents/path/to/file"
196 c, err := connparse.ParseURI(cstr)
197 if err != nil {
198 t.Fatalf("failed to parse URI: %v", err)
199 }
200 expected := "./Documents/path/to/file"
201 if c.Path != expected {
202 t.Fatalf("expected path to be \"%q\", got \"%q\"", expected, c.Path)
203 }
204 expected = "current"
205 if c.Host != expected {
206 t.Fatalf("expected host to be \"%q\", got \"%q\"", expected, c.Host)
207 }
208 expected = "wsh"
209 if c.Scheme != expected {
210 t.Fatalf("expected scheme to be \"%q\", got \"%q\"", expected, c.Scheme)
211 }
212 expected = "wsh://current/./Documents/path/to/file"
213 if c.GetFullURI() != expected {
214 t.Fatalf("expected full URI to be \"%q\", got \"%q\"", expected, c.GetFullURI())
215 }
216
217 cstr = "path/to/file"
218 c, err = connparse.ParseURI(cstr)
219 if err != nil {
220 t.Fatalf("failed to parse URI: %v", err)
221 }
222 expected = "path/to/file"
223 if c.Path != expected {
224 t.Fatalf("expected path to be %q, got %q", expected, c.Path)
225 }
226 expected = "current"
227 if c.Host != expected {
228 t.Fatalf("expected host to be %q, got %q", expected, c.Host)
229 }
230 expected = "wsh"
231 if c.Scheme != expected {
232 t.Fatalf("expected scheme to be %q, got %q", expected, c.Scheme)
233 }
234 expected = "wsh://current/path/to/file"
235 if c.GetFullURI() != expected {
236 t.Fatalf("expected full URI to be %q, got %q", expected, c.GetFullURI())
237 }
238
239 cstr = "/etc/path/to/file"
240 c, err = connparse.ParseURI(cstr)
241 if err != nil {
242 t.Fatalf("failed to parse URI: %v", err)
243 }
244 expected = "/etc/path/to/file"
245 if c.Path != expected {
246 t.Fatalf("expected path to be %q, got %q", expected, c.Path)
247 }
248 expected = "current"
249 if c.Host != expected {
250 t.Fatalf("expected host to be %q, got %q", expected, c.Host)
251 }

Callers

nothing calls this directly

Calls 2

ParseURIFunction · 0.92
GetFullURIMethod · 0.80

Tested by

no test coverage detected