Mikhail Galanin
02/03/2021, 1:00 PMio.kotest.core.datatest.NamesKt#isStable(kotlin.reflect.KType)
return false, when the parameter is enum class. Is it expected?wasyl
02/04/2021, 8:59 PMFoo
and a factory which always returns the same value as long as the previous one is still referenced:
class Foo
class FooFactory {
var fooRef: WeakReference<Foo>? = null
fun get() = fooRef?.get() ?: Foo().also { fooRef = WeakReference(it) }
}
So far so good. Now I have spec which should assert that the objects are in memory as expected. This overall might be tricky because GC is not very deterministic, but it’s stable enough:
class TestSpec : DescribeSpec() {
private val fooFactory = FooFactory()
init {
describe("foo") {
var foo: Foo? = fooFactory.get()
// println(foo)
describe("bar") {
gc()
fooFactory.fooRef?.get() shouldNot beNull()
foo = null
gc()
fooFactory.fooRef?.get() should beNull()
it("should do something") {
println("Done")
}
}
}
}
override fun isolationMode() = IsolationMode.InstancePerLeaf
}
And now the tricky part: if the println(foo)
is commented out, the test works. But if it’s not, then the test fails at the should beNull()
line. Apparently something is holding it. I checked in IJ’s memory tool and it looks like it’s just a variable being kept, but I have no clue why and how this would happen. Also I expect that with InstancePerLeaf
this entire thing is executed just once anyway, as there’s only one leaf. Any ideas?Big Chungus
02/04/2021, 10:27 PMwasyl
02/05/2021, 2:32 PMcause
. Is there an issue I can read to see what’s changed exactly?sam
02/06/2021, 7:08 PMHugo Martins
02/07/2021, 5:16 PMkotest
in Intellij, and adding a new module under kotest-extensions
(e.g. io.kotest.extensions.htmlreporter
), I can't for the life of me find a way to import io.kotest.core
. I'm sure this is probably something obvious that I'm missing but I've tried a couple different ways and can't seem to understand what...if anyone has any idea, I'd be extremely thankful. You can see the code (2 files) I added here:https://github.com/caramelomartins/kotest/tree/master/kotest-extensions/kotest-extensions-htmlreporter. Thanks!tseisel
02/08/2021, 8:42 AMdelay
and I'd like to check that at least X seconds has elapsed between 2 operations. TestCoroutineDispatcher
from kotlinx-coroutines-test
has this capability but I can't find a way to use it with StringSpec
.snowe
02/10/2021, 12:32 AMsnowe
02/10/2021, 12:33 AMmitch
02/10/2021, 8:02 PMmitch
02/13/2021, 9:34 AMdave08
02/15/2021, 3:06 PMStartable.perProject(...)
takes a name param, but doesn't work for a customized container...dave08
02/15/2021, 3:07 PMwhy
02/16/2021, 12:52 PMio.kotest:kotest-assertions-core:
in commonTest:
Compilation failed: Backend Internal error: Exception during IR lowering
File being compiled: /Users/runner/work/kotest/kotest/kotest-assertions/kotest-assertions-core/src/commonMain/kotlin/io/kotest/matchers/collections/decreasing.kt
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.ir.overrides.FakeOverrideBuilderStrategy.fakeOverrideMember(IrOverridingUtil.kt:43)
* Source files:
* Compiler version info: Konan: 1.4.30 / Kotlin: 1.4.30
* Output kind: STATIC_CACHE
dave08
02/16/2021, 12:59 PM~~~ Kotest Configuration ~~~
...
-> Extensions
- io.micronaut.test.extensions.kotest.MicronautKotestExtension
- io.kotest.engine.extensions.SystemPropertyTagExtension
- io.kotest.core.extensions.RuntimeTagExtension
- io.kotest.engine.extensions.RuntimeTagExpressionExtension
-> Listeners
- io.micronaut.test.extensions.kotest.MicronautKotestExtension
- beforeAfterAllListener$1
Rob Elliot
02/16/2021, 2:10 PMPaul Griffith
02/16/2021, 11:56 PMMockEngine
(from ktor) in a FunSpec
, and the code is definitely being run (I see the failure message being logged) but the actual test passesMarius Kotsbak
02/17/2021, 3:59 PMBig Chungus
02/17/2021, 4:08 PMEric Ampire [MOD]
02/18/2021, 6:48 AMrpillay
02/19/2021, 6:20 AMAndrei Casu Pop
02/24/2021, 7:30 PMimplementation 'io.kotest:kotest-framework-engine:$version'
Peter
03/03/2021, 10:43 PMjava.lang.NoSuchMethodError: 'java.lang.Object kotlinx.coroutines.DelayKt.delay-p9JZ4hM(double, kotlin.coroutines.Continuation)'
at io.kotest.assertions.timing.EventuallyKt.eventually(eventually.kt:118)
at io.kotest.assertions.timing.EventuallyKt$eventually$10.invokeSuspend(eventually.kt)
Paul Woitaschek
03/04/2021, 3:30 PMwatchos
shortcut, you have effectively removed watchosx86. Can you remove the shortcut and add the separate watchos targets manually?Peter
03/05/2021, 4:19 PM:services:shared:test
bbaldino
03/05/2021, 6:18 PMcontext("when starting a Foo") {
context("and thing A happens") {
should("throw an error") {
}
}
context("and thing B happens") {
should("throw an error") {
}
}
}
and when I get a failure, in the junit output I just get: "should throw an error"
for context, which is ambiguous between those 2 cases. Is there a way to get the full context “tree” when a failure happens?snowe
03/05/2021, 7:58 PMclass MathKtTest : FreeSpec({
data class Points(
val apr: String,
val term: Int
)
"calculate discount factor" - {
forAll(
row("1", 12)
) { (apr, term) ->
val D = calculateDiscountFactor(BigDecimal(apr), term)
assertEquals(BigDecimal("75.6813"), D)
}
}
})
method is a top level method
fun calculateDiscountFactor(apr: BigDecimal, term: Int) :BigDecimal{
val r = apr
val n = 12 * term
val denominator = { ((BigDecimal.ONE + apr).pow(n)) - BigDecimal.ONE }
val numerator = { r * (BigDecimal.ONE + r).pow(n) }
return numerator() / denominator()
}
kotest version 4.4.1, plugin version 1.1.30-IC-2020.3
kotlin version 1.3.72dave08
03/07/2021, 2:03 PMMao
03/08/2021, 5:47 AMkotest-extensions-robolectric
didn’t release with the latest version 4.4.x
but stay at 4.3.2
.
Is there any plan to bump it to the latest version?
https://mvnrepository.com/artifact/io.kotest/kotest-extensions-robolectric-jvmmitch
03/09/2021, 1:22 PMmitch
03/09/2021, 1:22 PMsam
03/09/2021, 1:22 PMmitch
03/09/2021, 1:27 PMtest("something") {
checkAll(
defaultPropTestConfig().withListeners(beforeAfterListener),
arbFoo,
arbBar
) { foo, bar ->
...
}
}
fun PropTestConfig.withListeners(vararg listeners: PropTestListener): PropTestConfig = ...
sam
03/09/2021, 1:28 PMmitch
03/09/2021, 1:29 PMcontext("foo") {
beforeProperty {
...
}
test(...) {
etc...
}
}
sam
03/09/2021, 1:32 PMmitch
03/09/2021, 1:38 PMContainerScope.checkAll(...)
sam
03/09/2021, 1:38 PMmitch
03/09/2021, 1:39 PMsam
03/09/2021, 1:39 PMmitch
03/09/2021, 1:41 PM