diff --git a/filesystem.go b/filesystem.go index 3c3e33d..c3c8aad 100644 --- a/filesystem.go +++ b/filesystem.go @@ -48,7 +48,7 @@ func (r operationRecord) summaryLine() (string, bool) { status := "OK" if r.err != nil { - status = fmt.Sprintf("FAIL: %v", r.err) + status = fmt.Sprintf("%sFAIL%s: %v", BRed, Reset, r.err) } else if r.dryRun { status = "DRY-RUN" } diff --git a/filesystem_test.go b/filesystem_test.go new file mode 100644 index 0000000..476b670 --- /dev/null +++ b/filesystem_test.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSummaryLineMarksFailuresInRed(t *testing.T) { + fs := NewRealFileSystem() + + fs.RecordLinkAttempt(opSymlink, "/tmp/source", "/tmp/target", fmt.Errorf("boom"), false) + + lines := fs.SummaryLines() + assert.Equal(t, 1, len(lines)) + assert.Contains(t, lines[0], BRed+"FAIL"+Reset) + assert.Contains(t, lines[0], "boom") +}