diff options
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index d3d5c2459..17f3a218a 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -222,6 +222,29 @@ func run(t *testing.T, ctx *android.TestContext, config android.Config) { android.FailIfErrored(t, errs) } +func testJavaError(t *testing.T, pattern string, bp string) { + t.Helper() + config := testConfig(nil) + ctx := testContext(bp, nil) + + pathCtx := android.PathContextForTesting(config, nil) + setDexpreoptTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx)) + + ctx.Register() + _, errs := ctx.ParseBlueprintsFiles("Android.bp") + if len(errs) > 0 { + android.FailIfNoMatchingErrors(t, pattern, errs) + return + } + _, errs = ctx.PrepareBuildActions(config) + if len(errs) > 0 { + android.FailIfNoMatchingErrors(t, pattern, errs) + return + } + + t.Fatalf("missing expected error %q (0 errors are returned)", pattern) +} + func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) { t.Helper() config := testConfig(nil) |