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

dmcg

11/09/2018, 8:38 AM
@robfletcher you asked a long time ago about referencing the fixture as
it
. I've been playing and think that I can do this
Copy code
data class Fruit(val name: String)
        data class Conserve(val type: String, val fruit: Fruit)

        junitTests<Fruit> {

            fixture {
                Fruit("blackcurrent")
            }

            derivedContext<Conserve>("inner") {

                deriveFixture {
                    assertEquals("blackcurrent", this.name)
                    assertEquals("blackcurrent", it.name)
                    assertEquals("blackcurrent", parentFixture.name)
                    // Doesn't compile
                    // assertEquals("blackcurrent", fixture.name)
                    Conserve("jam", parentFixture)
                }

                test("test") {
                    assertEquals("jam", this.type)
                    assertEquals("jam", it.type)
                    assertEquals("jam", fixture.type)
                    // Doesn't compile
                    // assertEquals("blackcurrent jam", parentFixture.fruit)
                }
            }
        }
r

robfletcher

11/09/2018, 5:55 PM
So
this
and
it
would point to the same thing?
2 Views