Make the prefix of generated functions customisable through KSP arguments#9
Open
arekolek wants to merge 1 commit into
Open
Make the prefix of generated functions customisable through KSP arguments#9arekolek wants to merge 1 commit into
arekolek wants to merge 1 commit into
Conversation
St4B
approved these changes
Jan 5, 2025
St4B
left a comment
Collaborator
There was a problem hiding this comment.
Nice one! This is something we were considering introducing. We discussed adding a field to the annotation to allow different configurations per fixture. It’s a slightly different approach, but something we could explore in the future. 🙂
| "$functionName()" | ||
| } | ||
|
|
||
| else -> error("${parameter.typeName}.${sealedEntry.name} must be an object or fixture based on filter in preconditions") |
Collaborator
There was a problem hiding this comment.
👏 This is very helpful for understanding on which class the generation failed. Great addition!
| parameter.entries.random() | ||
| val entries = parameter.entries.filter { it.isObject || it.isFixture } | ||
| require(entries.isNotEmpty()) { | ||
| "At least one sealed data class annotated with @Fixture is required in: ${parameter.type.copy(nullable = false)}" |
Collaborator
There was a problem hiding this comment.
This message might not fully account for scenarios where we have only objects, which is valid. Should we update it to reflect this case for better accuracy? 🤔
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature allows for easier adoption of the library when existing code base uses a different convention for naming test fixtures.
For example instead of
createFoo()there might benewFoo(),getFoo(), or simplyfoo().