Add t.Run and t.Helper to paths_test.go
Test: paths_test.go
Change-Id: Iea2b07815fe82a346c5384571ebc2b57538722cc
diff --git a/android/paths_test.go b/android/paths_test.go
index 61a172f..7e7ecbd 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -110,17 +110,21 @@
func TestValidateSafePath(t *testing.T) {
for _, testCase := range validateSafePathTestCases {
- ctx := &configErrorWrapper{}
- out := validateSafePath(ctx, testCase.in...)
- check(t, "validateSafePath", p(testCase.in), out, ctx.errors, testCase.out, testCase.err)
+ t.Run(strings.Join(testCase.in, ","), func(t *testing.T) {
+ ctx := &configErrorWrapper{}
+ out := validateSafePath(ctx, testCase.in...)
+ check(t, "validateSafePath", p(testCase.in), out, ctx.errors, testCase.out, testCase.err)
+ })
}
}
func TestValidatePath(t *testing.T) {
for _, testCase := range validatePathTestCases {
- ctx := &configErrorWrapper{}
- out := validatePath(ctx, testCase.in...)
- check(t, "validatePath", p(testCase.in), out, ctx.errors, testCase.out, testCase.err)
+ t.Run(strings.Join(testCase.in, ","), func(t *testing.T) {
+ ctx := &configErrorWrapper{}
+ out := validatePath(ctx, testCase.in...)
+ check(t, "validatePath", p(testCase.in), out, ctx.errors, testCase.out, testCase.err)
+ })
}
}
@@ -133,6 +137,7 @@
}
func checkInvalidOptionalPath(t *testing.T, path OptionalPath) {
+ t.Helper()
if path.Valid() {
t.Errorf("Uninitialized OptionalPath should not be valid")
}
@@ -150,9 +155,11 @@
func check(t *testing.T, testType, testString string,
got interface{}, err []error,
expected interface{}, expectedErr []error) {
+ t.Helper()
printedTestCase := false
e := func(s string, expected, got interface{}) {
+ t.Helper()
if !printedTestCase {
t.Errorf("test case %s: %s", testType, testString)
printedTestCase = true