Does anyone have any good resources for writing te...
# squarelibraries
d
Does anyone have any good resources for writing tests for custom Anvil CodeGenerators?
Ô׼ 2
r
I suggest following what Anvil itself is doing. You depend on the
compiler-utils
artifact:
Copy code
testImplementation testFixtures(project(":compiler-utils"))
(replace the project with the artifact from maven central). And then you can call
compileAnvil
to test arbitrary code. Your custom code generators should be called as well. A sample is here: https://github.com/square/anvil/blob/main/integration-tests/code-generator/src/test/java/com/squareup/anvil/test/TestCodeGeneratorTest.kt
­čĹĆ 1
d
Excellent! Thanks you!