https://kotlinlang.org logo
#minutest
Title
# minutest
d

dmcg

10/19/2018, 8:45 PM
@natpryce I'm thinking of moving the examples over to JUnitTests, but that is quite a commitment. How is it working for you?
n

natpryce

10/20/2018, 7:03 AM
It’s working out fine
d

dmcg

10/20/2018, 7:07 AM
I’m a bit conflicted. I’ve added some simpler examples to the start of the readme and it makes those simpler, but as soon as you have a test-specific fixture it’s a pain that you need to define it outside the object - so now I have to explain the two methods.
n

natpryce

10/20/2018, 10:17 AM
You don’t need to define it outside the object
Just outside the block that you pass to the constructor
Define a nested class in the body of the object and you can refer to it within the block
d

dmcg

10/20/2018, 10:23 AM
Ah, thanks, I’ll recast the examples.
Although I suppose then the fixture ends up after all the test code.
n

natpryce

10/20/2018, 10:27 AM
It does, which is a bit weird.
I’ve been a “main method at the bottom of the file” person since my C programming days
d

dmcg

10/20/2018, 12:41 PM
How about this
Copy code
object NewFixtureExampleTests : JUnitTests<Fixture>() {

    class Fixture {
        val stack1 = Stack<String>()
        val stack2 = Stack<String>()
    }

    override val tests = tests {
        fixture { Fixture() }

        test("swap top") {
...        }
    }
}
n

natpryce

10/20/2018, 12:52 PM
If that’s an optional override, yeah!
As in, pass a block to the closure as a shortcut
d

dmcg

10/20/2018, 12:52 PM
I'm going to make that one JUnitFixtureTests, leaving the old one alone
n

natpryce

10/20/2018, 12:53 PM
👍
5 Views