File: quiet.go

package info (click to toggle)
golang-github-approvals-go-approval-tests 0.0~git20180620.6ae1ec6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 296 kB
  • sloc: xml: 16; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package reporters

import (
	"fmt"
	"path/filepath"

	"github.com/approvals/go-approval-tests/utils"
)

type quiet struct{}

// NewQuietReporter creates a new reporter that does nothing.
func NewQuietReporter() Reporter {
	return &quiet{}
}

func (s *quiet) Report(approved, received string) bool {
	approvedFull, _ := filepath.Abs(approved)
	receivedFull, _ := filepath.Abs(received)

	if utils.DoesFileExist(approved) {
		fmt.Printf("approval files did not match\napproved: %v\nreceived: %v\n", approvedFull, receivedFull)

	} else {
		fmt.Printf("result never approved\napproved: %v\nreceived: %v\n", approvedFull, receivedFull)
	}

	return true
}