Skip to content

Commit

Permalink
[Clean-up]: Use multiline strings in hasErrorContaining(String).
Browse files Browse the repository at this point in the history
This CL cleans up TODOs related to b/243689574 now that multiline strings are allowed.

RELNOTES=N/A
PiperOrigin-RevId: 506053013
  • Loading branch information
bcorso authored and Dagger Team committed Jan 31, 2023
1 parent 363f1c3 commit 6a1e5bd
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ public void singletonSubcomponent() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining("conflicting scopes");
subject.hasErrorContaining("test.Parent also has @Singleton");
subject.hasErrorContaining(
String.join(
"\n",
"test.Child has conflicting scopes:",
" test.Parent also has @Singleton"));
});

// Check that compiling with disableInterComponentScopeValidation=none flag succeeds.
Expand Down Expand Up @@ -178,9 +180,11 @@ public void producerModuleRepeated() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining("test.Child repeats @ProducerModules:");
subject.hasErrorContaining("test.Parent also installs: test.RepeatedProducerModule")
subject.hasErrorContaining(
String.join(
"\n",
"test.Child repeats @ProducerModules:",
"test.Parent also installs: test.RepeatedProducerModule"))
.onSource(component)
.onLineContaining("interface Parent");
});
Expand Down Expand Up @@ -304,14 +308,13 @@ public void repeatedModulesWithScopes() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining(
"test.Child repeats modules with scoped bindings or declarations:");
subject.hasErrorContaining("- test.Parent also includes:");
subject.hasErrorContaining(
" - test.ModuleWithScopedProvides with scopes: @test.TestScope");
subject.hasErrorContaining(
" - test.ModuleWithScopedBinds with scopes: @test.TestScope");
String.join(
"\n",
"test.Child repeats modules with scoped bindings or declarations:",
"- test.Parent also includes:",
" - test.ModuleWithScopedProvides with scopes: @test.TestScope",
" - test.ModuleWithScopedBinds with scopes: @test.TestScope"));
});
}

Expand Down
30 changes: 18 additions & 12 deletions javatests/dagger/internal/codegen/ConflictingEntryPointsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ public void covariantType() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining("can only implement the method once. Found:");
subject.hasErrorContaining(" Long test.Base1.foo()");
subject.hasErrorContaining(" Number test.Base2.foo()")
subject.hasErrorContaining(
String.join(
"\n",
"can only implement the method once. Found:",
" Long test.Base1.foo()",
" Number test.Base2.foo()"))
.onSource(component)
.onLineContaining("interface TestComponent");
});
Expand Down Expand Up @@ -128,10 +130,12 @@ public void covariantTypeFromGenericSupertypes() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining("can only implement the method once. Found:");
subject.hasErrorContaining(" Long test.Base1.foo()");
subject.hasErrorContaining(" Number test.Base2.foo()")
subject.hasErrorContaining(
String.join(
"\n",
"can only implement the method once. Found:",
" Long test.Base1.foo()",
" Number test.Base2.foo()"))
.onSource(component)
.onLineContaining("interface TestComponent");
});
Expand Down Expand Up @@ -181,10 +185,12 @@ public void differentQualifier() {
.compile(
subject -> {
subject.hasErrorCount(1);
// TODO(b/243689574): Combine this to a single assertion once this bug is fixed.
subject.hasErrorContaining("can only implement the method once. Found:");
subject.hasErrorContaining(" Object test.Base1.foo()");
subject.hasErrorContaining(" @Named(\"foo\") Object test.Base2.foo()")
subject.hasErrorContaining(
String.join(
"\n",
"can only implement the method once. Found:",
" Object test.Base1.foo()",
" @Named(\"foo\") Object test.Base2.foo()"))
.onSource(component)
.onLineContaining("interface TestComponent");
});
Expand Down
Loading

0 comments on commit 6a1e5bd

Please sign in to comment.