-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-implement enum documentation test #3762
Conversation
Re-implement the enum documentation test to download and use the actual Kotlin stdlib enum source code for the synthetic enum functions. This avoids hardcoding a URL, and helps ensure the tests are properly cacheable (so they don't dynamically download files at runtime). - Add a utility, `downloadKotlinStdlibSources()`, to download the Kotlin stdlib source code. - Move StdLibDocumentationIntegrationTest.kt to plugin-base since it's not really an integration test, and otherwise it's hard to access the actual enum template files. - Update the enum template tests to test all templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The approach looks good to me, the only problem I see is with version of stdlib which is used for comparing.
We used master
version, but now we will use some specific version, so we will lag behind a bit. Not sure it will really matter.
build-logic/src/main/kotlin/dokkabuild/utils/downloadKotlinStdlibJvmSources.kt
Show resolved
Hide resolved
dokka-subprojects/plugin-base/src/test/kotlin/EnumTemplatesTest.kt
Outdated
Show resolved
Hide resolved
dokka-subprojects/plugin-base/src/test/kotlin/EnumTemplatesTest.kt
Outdated
Show resolved
Hide resolved
For context: I added it as an integration test became it made a network request that could hang, return an error or produce unexpected results. That's somewhat expected from integration (e2e) tests, but I certainly wouldn't expect unit tests to fail if GitHub is down |
build-logic/src/main/kotlin/dokkabuild/utils/downloadKotlinStdlibJvmSources.kt
Show resolved
Hide resolved
dokka-subprojects/plugin-base/src/test/kotlin/EnumTemplatesTest.kt
Outdated
Show resolved
Hide resolved
Good job! 👍 |
Re-implement the enum documentation test to download and use the actual Kotlin stdlib enum source code for the synthetic enum functions.
This avoids hardcoding a URL, and helps ensure the tests are properly cacheable (so they don't dynamically download files at runtime).
downloadKotlinStdlibJvmSources()
, to download the Kotlin stdlib source code.