Skip to content

Commit

Permalink
Rename format functions
Browse files Browse the repository at this point in the history
To match the new names for the format.
  • Loading branch information
dnephin committed Jun 20, 2020
1 parent 18ce2af commit a256bea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions testjson/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func standardQuietFormat(event TestEvent, _ *Execution) (string, error) {
return "", nil
}

func shortVerboseFormat(event TestEvent, exec *Execution) (string, error) {
func testNameFormat(event TestEvent, exec *Execution) (string, error) {
result := colorEvent(event)(strings.ToUpper(string(event.Action)))
formatTest := func() string {
pkgPath := RelativePackagePath(event.Package)
Expand Down Expand Up @@ -117,7 +117,7 @@ func all(cond ...bool) bool {

const cachedMessage = " (cached)"

func shortFormat(event TestEvent, exec *Execution) (string, error) {
func pkgNameFormat(event TestEvent, exec *Execution) (string, error) {
if !event.PackageEvent() {
return "", nil
}
Expand Down Expand Up @@ -163,7 +163,7 @@ func shortFormatPackageEvent(event TestEvent, exec *Execution) (string, error) {
return "", nil
}

func shortWithFailuresFormat(event TestEvent, exec *Execution) (string, error) {
func pkgNameWithFailuresFormat(event TestEvent, exec *Execution) (string, error) {
if !event.PackageEvent() {
if event.Action == ActionFail {
pkg := exec.Package(event.Package)
Expand Down Expand Up @@ -207,11 +207,11 @@ func NewEventFormatter(out io.Writer, format string) EventFormatter {
case "dots-v2":
return newDotFormatter(out)
case "testname", "short-verbose":
return &formatAdapter{out, shortVerboseFormat}
return &formatAdapter{out, testNameFormat}
case "pkgname", "short":
return &formatAdapter{out, shortFormat}
return &formatAdapter{out, pkgNameFormat}
case "pkgname-and-test-fails", "short-with-failures":
return &formatAdapter{out, shortWithFailuresFormat}
return &formatAdapter{out, pkgNameWithFailuresFormat}
default:
return nil
}
Expand Down
12 changes: 6 additions & 6 deletions testjson/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ func patchPkgPathPrefix(val string) func() {
return func() { pkgPathPrefix = oldVal }
}

func TestScanTestOutputWithShortVerboseFormat(t *testing.T) {
func TestScanTestOutput_WithTestNameFormat(t *testing.T) {
defer patchPkgPathPrefix("github.com/gotestyourself/gotestyourself")()

shim := newFakeHandlerWithAdapter(shortVerboseFormat, "go-test-json")
shim := newFakeHandlerWithAdapter(testNameFormat, "go-test-json")
exec, err := ScanTestOutput(shim.Config(t))

assert.NilError(t, err)
Expand Down Expand Up @@ -149,10 +149,10 @@ func TestScanTestOutputWithDotsFormatV1(t *testing.T) {
assert.DeepEqual(t, exec, expectedExecution, cmpExecutionShallow)
}

func TestScanTestOutputWithShortFormat(t *testing.T) {
func TestScanTestOutput_WithPkgNameFormat(t *testing.T) {
defer patchPkgPathPrefix("github.com/gotestyourself/gotestyourself")()

shim := newFakeHandlerWithAdapter(shortFormat, "go-test-json")
shim := newFakeHandlerWithAdapter(pkgNameFormat, "go-test-json")
exec, err := ScanTestOutput(shim.Config(t))

assert.NilError(t, err)
Expand All @@ -161,10 +161,10 @@ func TestScanTestOutputWithShortFormat(t *testing.T) {
assert.DeepEqual(t, exec, expectedExecution, cmpExecutionShallow)
}

func TestScanTestOutputWithShortFormat_WithCoverage(t *testing.T) {
func TestScanTestOutput_WithPkgNameFormat_WithCoverage(t *testing.T) {
defer patchPkgPathPrefix("gotest.tools")()

shim := newFakeHandlerWithAdapter(shortFormat, "go-test-json-with-cover")
shim := newFakeHandlerWithAdapter(pkgNameFormat, "go-test-json-with-cover")
exec, err := ScanTestOutput(shim.Config(t))

assert.NilError(t, err)
Expand Down

0 comments on commit a256bea

Please sign in to comment.