test_run

Declaration

test_run :: fn () s32

Description

Execute all registered test cases in current assembly. The test_run function uses compiler builtin testcases() function returning slice of all registered test cases in the current assembly (all function with hash directive #test).

Test case execution can be used in runtime and compile time, in both cases function remap default behaviour of panic() function call and try to report all failing tests without execution termination.

Formatted output containing information about every test run status and summary report is produced during execution of this function. In case of test failure all needed information about fail source location is reported into standard output.

Result

Number of failed tests.

Example

#load "std/test.bl"

my_test :: fn () #test {
    print("Hello from test case!!!\n");
}

main :: fn () s32 {
    return test_run();
}

Declared in: test.bl