https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
m

molikuner

10/20/2023, 12:22 AM
This looks like an (easy) job for (gnu) sed 🤔
Copy code
gsed -i '/^import io.kotest.core.spec.style.StringSpec$/{c\
import kotlin.test.Test\nimport kotlinx.coroutines.test.runTest
};/^class /s/: StringSpec(//;/^    "/{s/^    "\([^"]\+\)"/\1/ ; s/\([^[:alnum:]]\+\|^\|$\)\([0-9a-zA-Z]\)/\U\2/g ; s/^\(.\)/\l\1/ ; s/^/  @Test fun / ; s/ {$/() = runTest {/};s/^  }$/}/;s/^    \([^@]\)/  \1/;/^)/d' arrow-libs/fx/arrow-fx-stm/src/commonTest/kotlin/arrow/fx/stm/TSemaphoreTest.kt
It does the following 1. Replace the imports (import ordering is off with the current command, and for me spotless doesn’t fix it for some reason. Could be improved or IntelliJ organize import can fix it) 2. Remove the StringSpec inheritance 3. Replace the test names with camel case and add the call to runTest 4. fix the indentation 5. Remove the extra ) at the end of the file Even though I tried to fix the indentation, it probably makes sense to let IntelliJ auto format the files once before running spotless and committing. If you want, I can open a PR with such changes 😄
s

simon.vergauwen

10/20/2023, 7:01 AM
Hey Florian, If you can make that happend it'd be really great 😄 I think there are still some cases where we'll have to add
runTest(60.seconds) {
but wondering if we should fix those by hand. Also, I think we need to put back some configurations for mocha. But your script could/would do 95% of the work, so if you can make that happen. Please do 🙏
m

molikuner

10/20/2023, 10:12 AM
I opened one PR for arrow-fx-stm: https://github.com/arrow-kt/arrow/pull/3224 Please let me know what you think. Then I can already use the feedback for the following changes.