ceylon-sdk
ceylon-sdk copied to clipboard
ceylon.test::parameters is unintuitive when test is wrapped in a class
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.