(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…