Lyric v4.5.0

std.test

Marking tests, and the assertions that fail them. lyric test runs every function marked @Test in the project's test root; a test fails by panicking, which is what the assertions here do.

Test struct

pub struct Test :: [OnFunction]

Marks a top-level function as a test. lyric test finds it through the attribute row and runs it in a fresh instance; the function takes no parameters and returns nothing.

stdlib/std/test.lyr:16

assertTrue function

pub fn assertTrue(condition: bool, message: string): void

Fails the test with message when condition is false.

The same behavior as std.core.assert — it exists so a test file needs one import, and it delegates so there is one implementation.

stdlib/std/test.lyr:22

assertEq function

pub fn assertEq<T :: [Equatable<T>, Display]>(actual: T, expected: T): void

Fails the test when the two values differ, naming both.

stdlib/std/test.lyr:27