WDYT about allowing top-level specs? i.e. just def...
# kotest-contributors
e
WDYT about allowing top-level specs? i.e. just defining a spec like
Copy code
// any test source file

stringSpec("My spec") {
  "my test" {
     foo shouldBe bar
  }  
}
Kotlin will generate a wrapping class based on the filename, so if the example was defined in
foo.kt
, we would get a
FooKt
class calling the
stringSpec
function
Although.. it would fuck all navigation stuff.. so probably a terrible idea 💩
a
and the advantages of this are?
e
reduced ceremony mainly, but we probably need a named symbol for users to navigate to with fuzzy find etc
👍 1
a
that would not be very high on my list of priorities
l
I think we actually have this
kodee shocked 1
Or at least we used to have it at some point. Let me dive history a bit
This points me that the final solution became the test factories, but I believe a
top level test factory
can be executed
It was something like that. @sam really liked it and implemented something for this
Wait, actually
Most notable change is that test factories (previously value specs) are not in themselves considered executable units.
Buried by my own words xD
😁 1
How I can remember this and not remember if I had lunch or not is beyond me.
😂 1
e
Maybe your head is too busy memorizing 4000 kotest PRs/issues 😁
impressive, lol
s
We allowed tests in kotlin scripts in the past as a hidden feature I was working on
👍 1