airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.11k stars 107 forks source link

Refactor processor test resources and update kotlin poet #195

Closed elihart closed 2 years ago

elihart commented 2 years ago

I needed to update kotlin poet, but the newer version has some slight changes to output, notably that explicit public modifiers are now added. It would have been quite tedious to manually update all of the hard coded inputs and outputs of the processor tests, so I took this opportunity to refactor them.

The new approach stores all inputs and outputs in resource folders, with a specific folder per test class and test method. The resources are automatically retrieved based on the test name so the actual test function declaration is essentially just stating the test name and whether it expects to succeed or fail with a certain message.

There is also a new boolean flag that can be enabled to automatically update the outputs, which I used for the kotlinpoet update. This is split into a separate commit for easy reviewing.