MCPcopy Index your code
hub / github.com/coder/coder / Test_sshConfigSplitOnCoderSection

Function Test_sshConfigSplitOnCoderSection

cli/configssh_internal_test.go:17–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func Test_sshConfigSplitOnCoderSection(t *testing.T) {
18 t.Parallel()
19
20 testCases := []struct {
21 Name string
22 Input string
23 Before string
24 Section string
25 After string
26 Err bool
27 }{
28 {
29 Name: "Empty",
30 Input: "",
31 Before: "",
32 Section: "",
33 After: "",
34 Err: false,
35 },
36 {
37 Name: "JustSection",
38 Input: strings.Join([]string{sshStartToken, sshEndToken}, "\n"),
39 Before: "",
40 Section: strings.Join([]string{sshStartToken, sshEndToken}, "\n"),
41 After: "",
42 Err: false,
43 },
44 {
45 Name: "NoSection",
46 Input: strings.Join([]string{"# Some content"}, "\n"),
47 Before: "# Some content",
48 Section: "",
49 After: "",
50 Err: false,
51 },
52 {
53 Name: "Normal",
54 Input: strings.Join([]string{
55 "# Content before the section",
56 sshStartToken,
57 sshEndToken,
58 "# Content after the section",
59 }, "\n"),
60 Before: "# Content before the section",
61 Section: strings.Join([]string{"", sshStartToken, sshEndToken, ""}, "\n"),
62 After: "# Content after the section",
63 Err: false,
64 },
65 {
66 Name: "OutOfOrder",
67 Input: strings.Join([]string{
68 "# Content before the section",
69 sshEndToken,
70 sshStartToken,
71 "# Content after the section",
72 }, "\n"),
73 Err: true,
74 },

Callers

nothing calls this directly

Calls 4

RunMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected