Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
This repository was 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

@CPColin

Description

@CPColin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions