https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

Erik

12/13/2023, 3:56 PM
How do you name unit tests written with the
kotlin.test
API? I used to write test function names like
Copy code
fun `Given A, When B, Then C`() {}
But in my multiplatform project the comma
,
isn't allowed in test function names. Do you know about any practical naming conventions?
k

kevin.cianfarini

12/13/2023, 3:58 PM
backticks spaces also aren’t allowed in js source sets, so normally I do snake case in tests. I don’t like camel case for tests. This is likely an unpopular opinion.
gratitude thank you 2
j

Javier

12/13/2023, 4:36 PM
hope they fix the problem on JS tho, it is annoying mixing styles based on the project.
I do the same than the OP, but just without any capital letter except concrete names, replacing spaces if JS is involved
gratitude thank you 1
j

jw

12/13/2023, 4:49 PM
Backticks are allowed in JS. JS does not allow spaces, however
Underscore works everywhere if you need a stand in for a space.
gratitude thank you 2
2 Views