MCPcopy Create free account
hub / github.com/gogs/gogs / TestExec

Function TestExec

internal/testutil/exec_test.go:24–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestExec(t *testing.T) {
25 tests := []struct {
26 helper string
27 env string
28 expOut string
29 expErrMsg string
30 }{
31 {
32 helper: "NoTestsToRun",
33 expErrMsg: "no tests to run",
34 }, {
35 helper: "TestExecHelper",
36 expErrMsg: "exit status 1 - tests failed\n",
37 }, {
38 helper: "TestExecHelper",
39 env: "PASS=1",
40 expOut: "tests succeed",
41 },
42 }
43 for _, test := range tests {
44 t.Run("", func(t *testing.T) {
45 out, err := Exec(test.helper, test.env)
46 if test.expErrMsg != "" {
47 assert.Error(t, err)
48 assert.Contains(t, err.Error(), test.expErrMsg)
49 } else {
50 assert.NoError(t, err)
51 }
52 assert.Equal(t, test.expOut, out)
53 })
54 }
55}

Callers

nothing calls this directly

Calls 2

ExecFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected