MCPcopy
hub / github.com/cli/cli / TestParseSSHArgs

Function TestParseSSHArgs

internal/codespaces/ssh_test.go:15–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13}
14
15func TestParseSSHArgs(t *testing.T) {
16 testCases := []parseTestCase{
17 {}, // empty test case
18 {
19 Args: []string{"-X", "-Y"},
20 ParsedArgs: []string{"-X", "-Y"},
21 Command: nil,
22 },
23 {
24 Args: []string{"-X", "-Y", "-o", "someoption=test"},
25 ParsedArgs: []string{"-X", "-Y", "-o", "someoption=test"},
26 Command: nil,
27 },
28 {
29 Args: []string{"-X", "-Y", "-o", "someoption=test", "somecommand"},
30 ParsedArgs: []string{"-X", "-Y", "-o", "someoption=test"},
31 Command: []string{"somecommand"},
32 },
33 {
34 Args: []string{"-X", "-Y", "-o", "someoption=test", "echo", "test"},
35 ParsedArgs: []string{"-X", "-Y", "-o", "someoption=test"},
36 Command: []string{"echo", "test"},
37 },
38 {
39 Args: []string{"somecommand"},
40 ParsedArgs: []string{},
41 Command: []string{"somecommand"},
42 },
43 {
44 Args: []string{"echo", "test"},
45 ParsedArgs: []string{},
46 Command: []string{"echo", "test"},
47 },
48 {
49 Args: []string{"-v", "echo", "hello", "world"},
50 ParsedArgs: []string{"-v"},
51 Command: []string{"echo", "hello", "world"},
52 },
53 {
54 Args: []string{"-L", "-l"},
55 ParsedArgs: []string{"-L", "-l"},
56 Command: nil,
57 },
58 {
59 Args: []string{"-v", "echo", "-n", "test"},
60 ParsedArgs: []string{"-v"},
61 Command: []string{"echo", "-n", "test"},
62 },
63 {
64 Args: []string{"-v", "echo", "-b", "test"},
65 ParsedArgs: []string{"-v"},
66 Command: []string{"echo", "-b", "test"},
67 },
68 {
69 Args: []string{"-b"},
70 ParsedArgs: nil,
71 Command: nil,
72 Error: "flag: -b requires an argument",

Callers

nothing calls this directly

Calls 2

ParseSSHArgsFunction · 0.85
checkParseResultFunction · 0.85

Tested by

no test coverage detected