MCPcopy Create free account
hub / github.com/52funny/pikpakcli / TestResolveShellPath

Function TestResolveShellPath

internal/shell/shell_test.go:55–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestResolveShellPath(t *testing.T) {
56 tests := []struct {
57 name string
58 currentPath string
59 target string
60 want string
61 }{
62 {
63 name: "root home shortcut",
64 currentPath: "/Movies",
65 target: "~",
66 want: "/",
67 },
68 {
69 name: "relative child",
70 currentPath: "/Movies",
71 target: "Kids",
72 want: "/Movies/Kids",
73 },
74 {
75 name: "relative parent",
76 currentPath: "/Movies/Kids",
77 target: "..",
78 want: "/Movies",
79 },
80 {
81 name: "absolute path",
82 currentPath: "/Movies",
83 target: "/TV Shows/Drama",
84 want: "/TV Shows/Drama",
85 },
86 {
87 name: "clean repeated separators",
88 currentPath: "/Movies",
89 target: "Kids//Cartoons",
90 want: "/Movies/Kids/Cartoons",
91 },
92 {
93 name: "empty target goes root",
94 currentPath: "/Movies/Kids",
95 target: "",
96 want: "/",
97 },
98 }
99
100 for _, tt := range tests {
101 t.Run(tt.name, func(t *testing.T) {
102 require.Equal(t, tt.want, resolveShellPath(tt.currentPath, tt.target))
103 })
104 }
105}
106
107func TestSplitCompletionLine(t *testing.T) {
108 tests := []struct {

Callers

nothing calls this directly

Calls 1

resolveShellPathFunction · 0.85

Tested by

no test coverage detected