From 890996f5956cbdc4cc4bd98cd246f59ba264ae54 Mon Sep 17 00:00:00 2001 From: jaedle Date: Sun, 24 Feb 2019 17:12:22 +0100 Subject: [PATCH] hides commands keywoard if not present --- internal/summary/summary_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/internal/summary/summary_test.go b/internal/summary/summary_test.go index 2276be2b..8ea4b1bb 100644 --- a/internal/summary/summary_test.go +++ b/internal/summary/summary_test.go @@ -86,3 +86,19 @@ func TestPrintTaskCommandsIfPresent(t *testing.T) { assert.Contains(t, buffer.String(), "\n - command-2\n") assert.Contains(t, buffer.String(), "\n - command-3\n") } + +func TestDoesNotPrintCommandIfMissing(t *testing.T) { + buffer := &bytes.Buffer{} + l := logger.Logger{ + Stdout: buffer, + Stderr: buffer, + Verbose: false, + } + task := &taskfile.Task{ + Cmds: []*taskfile.Cmd{}, + } + + summary.Print(&l, task) + + assert.NotContains(t, buffer.String(), "commands") +}