Hey guys, I started a specification framework for kotin - GitHub - raniejade/kspec: Kotlin Specification Framework. It’s nothing big I just need something to practice on to improve my knowledge about Kotlin. For samples, you can check the tests.
DSL is heavily inspired by GitHub - Quick/Quick: The Swift (and Objective-C) testing framework..
class EqualsSpec: KSpec() {
override fun spec() {
describe("Equals") {
val matcher = Equals(1, null)
describe("match") {
context("passed argument is not equal to expected") {
it("should throw an AssertionError") {
expect({
matcher.match(2)
}).toBe(thrown(AssertionError::class))
}
}
context("passed argument is equal to expected") {
it("should not throw an exception") {
expect({
matcher.match(1)
}).toBe(notThrown())
}
}
}
}
}
}