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

Function TestParseShellArgs

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

Source from the content-addressed store, hash-verified

18)
19
20func TestParseShellArgs(t *testing.T) {
21 tests := []struct {
22 name string
23 input string
24 want []string
25 }{
26 {
27 name: "plain args",
28 input: "ls -l -p /Movies",
29 want: []string{"ls", "-l", "-p", "/Movies"},
30 },
31 {
32 name: "double quoted path",
33 input: `cd "/Movies/Kids Cartoons"`,
34 want: []string{"cd", "/Movies/Kids Cartoons"},
35 },
36 {
37 name: "single quoted path",
38 input: "cd '/Movies/Kids Cartoons'",
39 want: []string{"cd", "/Movies/Kids Cartoons"},
40 },
41 {
42 name: "escaped spaces",
43 input: `cd /My\ Pack/Kids\ Cartoons`,
44 want: []string{"cd", "/My Pack/Kids Cartoons"},
45 },
46 }
47
48 for _, tt := range tests {
49 t.Run(tt.name, func(t *testing.T) {
50 require.Equal(t, tt.want, parseShellArgs(tt.input))
51 })
52 }
53}
54
55func TestResolveShellPath(t *testing.T) {
56 tests := []struct {

Callers

nothing calls this directly

Calls 1

parseShellArgsFunction · 0.85

Tested by

no test coverage detected