-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update Flow.sample KDoc example timings, add tests #2259
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
Conversation
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes #2243
763a37f
to
d1bb071
Compare
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.
Nice addition to the Knit!
My comments regarding Knit tag in .kt files are not blockers and can be done later, it's up to you
@@ -33,7 +50,14 @@ import kotlin.time.* | |||
* emit(5) | |||
* }.debounce(1000) | |||
* ``` | |||
* produces `3, 4, 5`. | |||
* <!--- KNIT example-delay-01.kt --> |
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.
It would be nice if these tests could be numbered automatically without interfering with the source.
In general, I do no mind having Knit-specific directives in our markdown, but this documentation will likely be read from the IDEA rather than from a webpage with processed markdown, so reducing the number of MD tags would be nice
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.
They are automatically numbered. When writing those directives you can use any number or even just a placeholder like <!--- KNIT example-delay-num.kt -->
and when you run gradlew knit
it will renumber them sequentially and will update the corresponding source files.
@@ -14,13 +14,30 @@ import kotlinx.coroutines.selects.* | |||
import kotlin.jvm.* | |||
import kotlin.time.* | |||
|
|||
/* Scaffolding for Knit code examples | |||
<!--- TEST_NAME FlowDelayTest --> |
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.
Same here, would be nice to hide it in an external file
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.
Yes. That would be a nice addition. Created Kotlin/kotlinx-knit#18 and Kotlin/kotlinx-knit#19
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes Kotlin#2243
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes Kotlin#2243
Fixes #2243