Lyricdev
GitHub

LYR-SEM0154

a test takes parameters, returns a value or is private

error ยท spec 11-metaprogramming

A function marked @Test takes parameters, returns something other than void, or is private.

Explanation

lyric test calls every test from a module of its own and with no arguments, and has no use for a value. So a test takes no parameters, returns void and is not private. It may throw: an error that leaves it fails the test.

Move the inputs into the body, check results with assert instead of returning them, and drop private.

Wrong

@Test
fn answers(): int {
    return 42;
}

fn main(): void {
}
@Test
fn answers(): void {
    assert(6 * 7 == 42);
}

fn main(): void {
}