From a4a20d92a4f1dcca92cc727dc1c3dd7e45dcc959 Mon Sep 17 00:00:00 2001 From: jaedle Date: Sun, 24 Feb 2019 17:20:29 +0100 Subject: [PATCH] add unit test for full output --- internal/summary/summary_test.go | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/internal/summary/summary_test.go b/internal/summary/summary_test.go index 8ea4b1bb..872d8dcf 100644 --- a/internal/summary/summary_test.go +++ b/internal/summary/summary_test.go @@ -102,3 +102,40 @@ func TestDoesNotPrintCommandIfMissing(t *testing.T) { assert.NotContains(t, buffer.String(), "commands") } + +func TestFullSummary(t *testing.T) { + buffer := &bytes.Buffer{} + l := logger.Logger{ + Stdout: buffer, + Stderr: buffer, + Verbose: false, + } + task := &taskfile.Task{ + Task: "sample-task", + Summary: "line1\nline2\nline3\n", + Deps: []*taskfile.Dep{ + {Task: "dependency"}, + }, + Cmds: []*taskfile.Cmd{ + {Cmd: "command"}, + }, + } + + summary.Print(&l, task) + + expected := + `task: sample-task + +line1 +line2 +line3 + +dependencies: + - dependency + +commands: + - command +` + + assert.Equal(t, expected, buffer.String()) +}