MCPcopy
hub / github.com/passteque/gluetun / Test_Split

Function Test_Split

internal/command/split_test.go:9–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_Split(t *testing.T) {
10 t.Parallel()
11
12 testCases := map[string]struct {
13 command string
14 words []string
15 errWrapped error
16 errMessage string
17 }{
18 "empty": {
19 command: "",
20 errWrapped: ErrCommandEmpty,
21 errMessage: "command is empty",
22 },
23 "concrete_sh_command": {
24 command: `/bin/sh -c "echo 123"`,
25 words: []string{"/bin/sh", "-c", "echo 123"},
26 },
27 "single_word": {
28 command: "word1",
29 words: []string{"word1"},
30 },
31 "two_words_single_space": {
32 command: "word1 word2",
33 words: []string{"word1", "word2"},
34 },
35 "two_words_multiple_space": {
36 command: "word1 word2",
37 words: []string{"word1", "word2"},
38 },
39 "two_words_no_expansion": {
40 command: "word1* word2?",
41 words: []string{"word1*", "word2?"},
42 },
43 "escaped_single quote": {
44 command: "ain\\'t good",
45 words: []string{"ain't", "good"},
46 },
47 "escaped_single_quote_all_single_quoted": {
48 command: "'ain'\\''t good'",
49 words: []string{"ain't good"},
50 },
51 "empty_single_quoted": {
52 command: "word1 '' word2",
53 words: []string{"word1", "", "word2"},
54 },
55 "escaped_newline": {
56 command: "word1\\\nword2",
57 words: []string{"word1word2"},
58 },
59 "quoted_newline": {
60 command: "text \"with\na\" quoted newline",
61 words: []string{"text", "with\na", "quoted", "newline"},
62 },
63 "quoted_escaped_newline": {
64 command: "\"word1\\d\\\\\\\" word2\\\nword3 word4\"",
65 words: []string{"word1\\d\\\" word2word3 word4"},
66 },

Callers

nothing calls this directly

Calls 3

SplitFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected