testing
Tester
object Tester
Test runner with assertion helpers.
tests
tests: mut [bool]
Test results.
asserts
asserts: mut [bool]
Assertion results.
elapsed
elapsed: double
Elapsed test time in milliseconds.
beforeAll
beforeAll: fun anonymous(t: Tester) > void?
Hook run once before all tests.
beforeEach
beforeEach: fun anonymous(t: Tester) > void?
Hook run before each test.
afterAll
afterAll: fun anonymous(t: Tester) > void?
Hook run once after all tests.
afterEach
afterEach: fun anonymous(t: Tester) > void?
Hook run after each test.
init
static fun init(beforeAll: fun anonymous(t: Tester) > void?, beforeEach: fun anonymous(t: Tester) > void?, afterAll: fun anonymous(t: Tester) > void?, afterEach: fun anonymous(t: Tester) > void?) > mut Tester
Creates a new tester and runs the beforeAll hook when provided.
beforeAll: Hook run once before all testsbeforeEach: Hook run before each testafterAll: Hook run once after all testsafterEach: Hook run after each test Returns: A newTester
reset
fun reset() > void
Clears test results and elapsed time.
failedAsserts
fun failedAsserts() > int
Returns: number of failed assertions
failedTests
fun failedTests() > int
Returns: number of failed tests
succeededTests
fun succeededTests() > int
Returns: number of succeeded tests
it
fun it(message: str, fn: fun anonymous() > void) > void
Runs a test case.
message: Test descriptionfn: Test body
summary
fun summary() > void
Prints a test summary and exits with a failure code when any test failed.
report
fun report(error: str?, message: str?) > void
Reports an assertion failure.
error: Error detailsmessage: Assertion message
assert
fun assert(condition: bool, error: str?, message: str?) > void
Records whether an assertion condition succeeded.
condition: Condition that must be trueerror: Error details printed when falsemessage: Assertion message
assertEqual
fun assertEqual(actual: any, expected: any, message: str?) > void
Asserts that two values are equal.
actual: Actual valueexpected: Expected valuemessage: Assertion message
assertNotEqual
fun assertNotEqual(actual: any, expected: any, message: str?) > void
Asserts that two values are not equal.
actual: Actual valueexpected: Value that should differmessage: Assertion message
assertAreEqual
fun assertAreEqual(values: [any], message: str?) > void
Asserts that all values are equal.
values: Values to comparemessage: Assertion message
assertAreNotEqual
fun assertAreNotEqual(values: [any], message: str?) > void
Asserts that adjacent values are not equal.
values: Values to comparemessage: Assertion message
assertOfType
fun assertOfType::<T>(value: any, message: str?) > void
Asserts that a value has type T.
value: Value to checkmessage: Assertion message
assertThrows
fun assertThrows::<T>(fn: fun () > void !> T, message: str?) > void
Asserts that a function throws an error of type T.
fn: Function expected to throwmessage: Assertion message
assertDoesNotThrow
fun assertDoesNotThrow::<T>(fn: fun anonymous() > void, message: str?) > void
Asserts that a function does not throw an error of type T.
fn: Function expected not to throwmessage: Assertion message
