MCPcopy Create free account
hub / github.com/docker/compose / wcLineCount

Function wcLineCount

pkg/e2e/hooks_test.go:29–36  ·  view source on GitHub ↗

wcLineCount parses the leading integer from a `wc -l ` stdout, whose shape is " ". Fails the test if the output cannot be parsed.

(t *testing.T, stdout string)

Source from the content-addressed store, hash-verified

27// wcLineCount parses the leading integer from a `wc -l <file>` stdout, whose
28// shape is "<count> <filename>". Fails the test if the output cannot be parsed.
29func wcLineCount(t *testing.T, stdout string) int {
30 t.Helper()
31 fields := strings.Fields(stdout)
32 assert.Assert(t, len(fields) > 0, "expected wc -l output, got: %q", stdout)
33 n, err := strconv.Atoi(fields[0])
34 assert.NilError(t, err, "expected leading integer in wc -l output, got: %q", stdout)
35 return n
36}
37
38func TestPostStartHookInError(t *testing.T) {
39 c := NewParallelCLI(t)

Calls

no outgoing calls

Tested by

no test coverage detected