MCPcopy Create free account
hub / github.com/driangle/taskmd / TestExpandTilde

Function TestExpandTilde

apps/cli/internal/cli/registry_test.go:277–303  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

275}
276
277func TestExpandTilde(t *testing.T) {
278 home, err := os.UserHomeDir()
279 if err != nil {
280 t.Skip("cannot get home dir")
281 }
282
283 tests := []struct {
284 input string
285 expected string
286 }{
287 {"~/foo/bar", filepath.Join(home, "foo/bar")},
288 {"~", home},
289 {"/absolute/path", "/absolute/path"},
290 {"relative/path", "relative/path"},
291 }
292
293 for _, tt := range tests {
294 got, err := expandTilde(tt.input)
295 if err != nil {
296 t.Errorf("expandTilde(%q): unexpected error: %v", tt.input, err)
297 continue
298 }
299 if got != tt.expected {
300 t.Errorf("expandTilde(%q) = %q, want %q", tt.input, got, tt.expected)
301 }
302 }
303}

Callers

nothing calls this directly

Calls 1

expandTildeFunction · 0.85

Tested by

no test coverage detected