MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestAppendScript

Function TestAppendScript

internal/devbox/shellcmd/command_test.go:176–255  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

174}
175
176func TestAppendScript(t *testing.T) {
177 tests := []struct {
178 name string
179 script string
180 wantCmds []string
181 }{
182 {
183 name: "Empty",
184 script: "",
185 wantCmds: nil,
186 },
187 {
188 name: "OnlySpaces",
189 script: " ",
190 wantCmds: nil,
191 },
192 {
193 name: "Only newlines",
194 script: "\r\n",
195 wantCmds: nil,
196 },
197 {
198 name: "Simple",
199 script: "echo test",
200 wantCmds: []string{"echo test"},
201 },
202 {
203 name: "LeadingNewline",
204 script: "\necho test",
205 wantCmds: []string{"echo test"},
206 },
207 {
208 name: "LeadingNewlineAndSpace",
209 script: "\n echo test",
210 wantCmds: []string{"echo test"},
211 },
212 {
213 name: "TrailingWhitespace",
214 script: "echo test \n",
215 wantCmds: []string{"echo test"},
216 },
217 {
218 name: "SecondLineIndent",
219 script: "if true; then\n\techo test\nfi",
220 wantCmds: []string{
221 "if true; then",
222 "\techo test",
223 "fi",
224 },
225 },
226 {
227 name: "Unindent",
228 script: "\n\tif true; then\n\t\techo test\n\tfi",
229 wantCmds: []string{
230 "if true; then",
231 "\techo test",
232 "fi",
233 },

Callers

nothing calls this directly

Calls 2

AppendScriptMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected