Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

ceylon.test::parameters is unintuitive when test is wrapped in a class #700

Open
CPColin opened this issue Mar 29, 2018 · 0 comments
Open

Comments

@CPColin
Copy link
Contributor

CPColin commented Mar 29, 2018

When writing tests with the ceylon.test module, the parameters annotation is unintuitive to use when the test has been encapsulated in an object or a class, because the annotation may only refer to top-level declarations. Attempting to encapsulate the source of the parameters in the same scope as the test that uses it leads to a compiler error: "Metamodel reference to local declaration".

shared class Tests() {
    value testParameters = [0, 1, 2, 3];

    test
    parameters(`value testParameters`) // Error
    shared void doTest(Integer parameter) { ... }
}

The need to make the parameters top-level declarations also prevents the use of type inference, leading to declarations with gross types like {[Integer, String, String]*} hanging out far away from the code that uses them.

I don't know if there's a way around this, though.

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

No branches or pull requests

1 participant