Skip to content

Commit

Permalink
Improve output of subtests when emulated
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Oct 13, 2016
1 parent 9b4126c commit df37870
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .scripts/test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ fi
go get -u github.com/aws/aws-sdk-go/...

# Test all packages which are allowed on all Go versions
go test $packages
go test -v $packages
13 changes: 10 additions & 3 deletions subtest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ package tusd_test

import (
"fmt"
"strings"
"testing"

"github.com/golang/mock/gomock"
)

var subTestDepth = 0

func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataStore)) {
fmt.Println("\t=== RUN SubTest:", name)
subTestDepth++
defer func() { subTestDepth-- }()
p := strings.Repeat("\t", subTestDepth)

fmt.Println(p, "=== RUN SubTest:", name)

ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand All @@ -20,9 +27,9 @@ func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataSt
runTest(t, store)

if t.Failed() {
fmt.Println("\t--- FAIL SubTest:", name)
fmt.Println(p, "--- FAIL SubTest:", name)
t.FailNow()
} else {
fmt.Println("\t--- PASS SubTest:", name)
fmt.Println(p, "--- PASS SubTest:", name)
}
}

0 comments on commit df37870

Please sign in to comment.