MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestShellCatError

Function TestShellCatError

pkg/devspace/pipeline/engine/engine_test.go:52–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestShellCatError(t *testing.T) {
53 testCases := []testCaseShell{
54 {
55 command: "cat noFile.txt",
56 expectedOutput: "cat: noFile.txt: No such file or directory\n",
57 },
58 }
59
60 for _, testCase := range testCases {
61 stderr := &bytes.Buffer{}
62 err := ExecuteSimpleShellCommand(context.Background(), ".", expand.ListEnviron(os.Environ()...), stderr, stderr, nil, testCase.command)
63 if err != nil {
64 if stderr.String() != "" {
65 assert.Equal(t, stderr.String(), testCase.expectedOutput)
66 } else {
67 t.Fatal(err)
68 }
69 } else {
70 t.Fatal("FAIL: TestShellCatError")
71 }
72
73 }
74}
75
76// this test forces the cat implementation to execute
77func TestShellCatEnforce(t *testing.T) {

Callers

nothing calls this directly

Calls 5

StringMethod · 0.95
EqualMethod · 0.80
EnvironMethod · 0.65
FatalMethod · 0.45

Tested by

no test coverage detected