Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom generator for property-based testing #313

Closed
russel opened this issue Apr 25, 2018 · 2 comments
Closed

Custom generator for property-based testing #313

russel opened this issue Apr 25, 2018 · 2 comments

Comments

@russel
Copy link

russel commented Apr 25, 2018

https://github.com/kotlintest/kotlintest/blob/master/doc/reference.md gives the example:

data class Person(val name: String, val age: Int)
class PersonGenerator : Gen<Person> {
    override fun always() = emptyList<Person>()
    override fun random() = generateSequence {
        Person(Gen.string().random().first(), Gen.int().random().first())
    }
}

but following this example with Kotlintest 3.1.0 reports that always is not a method in the interface Gen, and that constants is not defined. Is it just that the documentation is for 3.0.x and this is a breaking change for 3.1.x?

@sksamuel
Copy link
Member

Yes I'll fix the docs and add a deprecated migration method.

@sksamuel
Copy link
Member

Docs updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants