diff options
author | Colin Cross <ccross@android.com> | 2018-02-23 02:38:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-02-23 02:38:58 +0000 |
commit | 945aebf48e4469f05c20dfe63a94c4a37ad790cf (patch) | |
tree | 439c9aae14934eda141996bf5843be26cc387137 /android/paths_test.go | |
parent | 230c992943c6362911f6e2eec619d3e2b5e6d8a4 (diff) | |
parent | b3407069ee328b17f1e38d380003a26379b3cf7a (diff) | |
download | build_soong-945aebf48e4469f05c20dfe63a94c4a37ad790cf.tar.gz build_soong-945aebf48e4469f05c20dfe63a94c4a37ad790cf.tar.bz2 build_soong-945aebf48e4469f05c20dfe63a94c4a37ad790cf.zip |
Merge changes If1894fd9,Id7925999,I4fe11c3f,Iea2b0781,Id2c0a503 am: 1b5599e462
am: b3407069ee
Change-Id: Ib0f7f8e93842cea36b915c1e10929f96249c20e3
Diffstat (limited to 'android/paths_test.go')
-rw-r--r-- | android/paths_test.go | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/android/paths_test.go b/android/paths_test.go index 61a172fa..00757985 100644 --- a/android/paths_test.go +++ b/android/paths_test.go @@ -110,17 +110,27 @@ var validatePathTestCases = append(commonValidatePathTestCases, []strsTestCase{ 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, err := validateSafePath(testCase.in...) + if err != nil { + reportPathError(ctx, err) + } + 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, err := validatePath(testCase.in...) + if err != nil { + reportPathError(ctx, err) + } + check(t, "validatePath", p(testCase.in), out, ctx.errors, testCase.out, testCase.err) + }) } } @@ -133,6 +143,7 @@ func TestOptionalPath(t *testing.T) { } func checkInvalidOptionalPath(t *testing.T, path OptionalPath) { + t.Helper() if path.Valid() { t.Errorf("Uninitialized OptionalPath should not be valid") } @@ -150,9 +161,11 @@ func checkInvalidOptionalPath(t *testing.T, path OptionalPath) { 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 |