I’m playing around with an alternative syntax, to ...
# failgood
c
I’m playing around with an alternative syntax, to allow sub contexts that do need to create the dependencies of the parent context:
Copy code
describe("context with dependency lambda", {"StringDependency"}, {/* optional teardown*/}) {
                    test("test that takes a string dependency") { string ->
                        expectThat(string).isEqualTo("StringDependency")
                    }
                    describe("a child context that uses the parent dependencies. for tests in this context both the parent and this context dependencies are constructed", {parentDependency-> parentDependency+"AddedString"}) {
                        test("another test that takes a string dependency") { string ->
                            expectThat(string).isEqualTo("StringDependencyAddedString")
                        }
                    }
                    describe("a child context that does not use the parent dependency. for tests in this context the parent context dependencies are not constructed", {->"TotallyNewString"}) {
                        test("another test that takes a string dependency") { string ->
                            expectThat(string).isEqualTo("TotallyNewString")
                        }
                    }
                }
but I guess in can just use by lazy {} for the parent context dependencies if i really need that.
of course i cannot really use by lazy when my dependencies need coroutines.