really strange issue with datatest and the intelli...
# kotest
s
really strange issue with datatest and the intellij plugin. If I use
Int
as the type here, the tests render in the run panel correctly. But if I switch to
Number
, the tests render indexed, without parameters displayed, also it shows the FQDN rather than just the
Adder
name.
oh, and it also throws warnings due to the same test name
Copy code
WARN: Duplicated test name com.sunrun.pricing.flex.BaseAdder. To disable this message, set DuplicateTestNameMode to None.
e
Seems to be due to
Number
not being considered a primitive when checking if it’s stable to use for generating names. Maybe it should be - any implementation of
Number
must be a platform primitive, right?
🤔 nvm, anything can implement it so I suppose it makes sense https://github.com/kotest/kotest/blob/master/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/test/Identifiers.kt https://github.com/kotest/kotest/blob/master/kotest-common/src/commonMain/kotlin/io/kotest/mpp/stable.kt
You could perhaps provide the
nameFn
explicitly, like
Copy code
withData {
  nameFn = BaseAdder::toString,
  BaseAdder(..),
  ..
s
@Emil Kantis that worked! interesting. not sure I understand why that worked though.
e
I think this page explains it better than I could 🙂
s
Kotest will only use the toString() of the input class if it thinks the input class has a stable toString() value otherwise it will use the class name.
ah. that does explain it.