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

returnOf on a nested property always fails #23

Open
a-xp opened this issue Jun 12, 2023 · 0 comments
Open

returnOf on a nested property always fails #23

a-xp opened this issue Jun 12, 2023 · 0 comments

Comments

@a-xp
Copy link

a-xp commented Jun 12, 2023

class MyTest {
    
    class A {
        fun t(): Int {
            return 0
        }
    }
    
    data class B(val nested: A = A())

    @Test
    fun test() {
        val spec = validationSpec {
            constraints<B> {
                property(B::nested) {
                    valid()
                }
            }
            constraints<A> {
                returnOf(A::t) {
                    positive()
                }
            }
        }
        spec.validate(B())
    }
}

Throws: A.t() kotlin.Int must belong to class B(nested=A())) to be callable

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

1 participant