Debian Codegraph @

subprocess/subprocess_test.go

raw symbols SCIP
1 package subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
5
6 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
7 )
8
9 type ShellQuoteTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase# struct {
10 Givenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Given. []string
11 Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Expected. []string
12 }
13
14 func (c *ShellQuoteTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#) Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Assert().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
15 actual := ShellQuotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuote().(c.Givenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Given.)
16
17 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, c.Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Expected., actual,
18 "subprocess: expected ShellQuote(%q) to equal %#v (was %#v)",
19 c.Givenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Given., c.Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Expected., actual,
20 )
21 }
22
23 func TestShellQuotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/TestShellQuote().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
24 for desc, c := range map[string]ShellQuoteTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#{
25 "simple": {[]string{"foo", "bar", "an_id"}, []string{"foo", "bar", "an_id"}},
26 "leading space": {[]string{" foo", "bar"}, []string{"' foo'", "bar"}},
27 "trailing space": {[]string{"foo", "bar "}, []string{"foo", "'bar '"}},
28 "internal space": {[]string{"foo bar", "baz quux"}, []string{"'foo bar'", "'baz quux'"}},
29 "backslash": {[]string{`foo\bar`, `b\az`}, []string{`'foo\bar'`, `'b\az'`}},
30 "quotes": {[]string{`foo"bar`, "b'az"}, []string{`'foo"bar'`, "'b'\\''az'"}},
31 "mixed quotes": {[]string{`"foo'ba\"r\"'"`}, []string{`'"foo'\''ba\"r\"'\''"'`}},
32 } {
33 t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(desc, c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ShellQuoteTestCase#Assert().)
34 }
35 }
36
37 type FormatForShellQuotedArgsTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase# struct {
38 GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenCmd. string
39 GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenArgs. []string
40 ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#ExpectedArgs. []string
41 }
42
43 func (c *FormatForShellQuotedArgsTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#) Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#Assert().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
44 actualCmd, actualArgs := FormatForShellQuotedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgs().(c.GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenCmd., c.GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenArgs.)
45
46 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "sh", actualCmd,
47 "subprocess: expected FormatForShell command to equal 'sh' (was #%v)",
48 actualCmd)
49 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, c.ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#ExpectedArgs., actualArgs,
50 "subprocess: expected FormatForShell(%q, %v) to equal %#v (was %#v)",
51 c.GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenCmd., c.GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#GivenArgs., c.ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#ExpectedArgs., actualArgs,
52 )
53 }
54
55 func TestFormatForShellQuotedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/TestFormatForShellQuotedArgs().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
56 for desc, c := range map[string]FormatForShellQuotedArgsTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#{
57 "simple": {"foo", []string{"bar", "baz"}, []string{"-c", "foo bar baz"}},
58 "spaces": {"foo quux", []string{" bar", "baz "}, []string{"-c", "foo quux ' bar' 'baz '"}},
59 "backslashes": {"bin/foo", []string{"\\bar", "b\\az"}, []string{"-c", "bin/foo '\\bar' 'b\\az'"}},
60 } {
61 t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(desc, c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellQuotedArgsTestCase#Assert().)
62 }
63 }
64
65 type FormatForShellTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase# struct {
66 GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenCmd. string
67 GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenArgs. string
68 ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#ExpectedArgs. []string
69 }
70
71 func (c *FormatForShellTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#) Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#Assert().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
72 actualCmd, actualArgs := FormatForShellscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShell().(c.GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenCmd., c.GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenArgs.)
73
74 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "sh", actualCmd,
75 "subprocess: expected FormatForShell command to equal 'sh' (was #%v)",
76 actualCmd)
77 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, c.ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#ExpectedArgs., actualArgs,
78 "subprocess: expected FormatForShell(%q, %v) to equal %#v (was %#v)",
79 c.GivenCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenCmd., c.GivenArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#GivenArgs., c.ExpectedArgsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#ExpectedArgs., actualArgs,
80 )
81 }
82
83 func TestFormatForShellscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/TestFormatForShell().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
84 for desc, c := range map[string]FormatForShellTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#{
85 "simple": {"foo", "bar", []string{"-c", "foo bar"}},
86 "spaces": {"foo quux", "bar baz", []string{"-c", "foo quux bar baz"}},
87 "quotes": {"bin/foo", "bar \"baz quux\" 'fred wilma'", []string{"-c", "bin/foo bar \"baz quux\" 'fred wilma'"}},
88 } {
89 t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(desc, c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatForShellTestCase#Assert().)
90 }
91 }
92
93 type FormatPercentSequencesTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase# struct {
94 GivenPatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenPattern. string
95 GivenReplacementsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenReplacements. map[string]string
96 ExpectedStringscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#ExpectedString. string
97 }
98
99 func (c *FormatPercentSequencesTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#) Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#Assert().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
100 actualString := FormatPercentSequencesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequences().(c.GivenPatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenPattern., c.GivenReplacementsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenReplacements.)
101
102 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, c.ExpectedStringscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#ExpectedString., actualString,
103 "subprocess: expected FormatForShell(%q, %v) to equal %q (was %q)",
104 c.GivenPatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenPattern., c.GivenReplacementsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#GivenReplacements., c.ExpectedStringscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#ExpectedString., actualString,
105 )
106 }
107
108 func TestFormatPercentSequencesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/TestFormatPercentSequences().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
109 replacements := map[string]string{
110 "A": "current",
111 "B": "other file",
112 "P": "some ' output \" file",
113 }
114 for desc, c := range map[string]FormatPercentSequencesTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#{
115 "simple": {"merge-foo %A", replacements, "merge-foo current"},
116 "double-percent": {"merge-foo %A %%A", replacements, "merge-foo current %A"},
117 "spaces": {"merge-foo %B", replacements, "merge-foo 'other file'"},
118 "weird filename": {"merge-foo %P", replacements, "merge-foo 'some '\\'' output \" file'"},
119 "no patterns": {"merge-foo /dev/null", replacements, "merge-foo /dev/null"},
120 "pattern adjacent to non-space": {"merge-foo >%B", replacements, "merge-foo >'other file'"},
121 } {
122 t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(desc, c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/FormatPercentSequencesTestCase#Assert().)
123 }
124 }