MCPcopy Create free account
hub / github.com/docker/cli / TestPrintHookMessages

Function TestPrintHookMessages

cli-plugins/hooks/printer_test.go:11–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestPrintHookMessages(t *testing.T) {
12 const header = "\n\x1b[1mWhat's next:\x1b[0m\n"
13
14 tests := []struct {
15 doc string
16 messages []string
17 expectedOutput string
18 }{
19 {
20 doc: "no messages",
21 messages: nil,
22 expectedOutput: "",
23 },
24 {
25 doc: "single message",
26 messages: []string{"Bork!"},
27 expectedOutput: header +
28 " Bork!\n",
29 },
30 {
31 doc: "multiple messages",
32 messages: []string{"Foo", "bar"},
33 expectedOutput: header +
34 " Foo\n" +
35 " bar\n",
36 },
37 }
38 for _, tc := range tests {
39 t.Run(tc.doc, func(t *testing.T) {
40 var w strings.Builder
41 hooks.PrintNextSteps(&w, tc.messages)
42 assert.Equal(t, w.String(), tc.expectedOutput)
43 })
44 }
45}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…