Skip to content
FutureBlitz

    Install

    Tools

    fb test

    Compiles a package's tests and runs them.

    fb test [options] [file.fb | package folder | std]

    fb test builds every @Test Function of a package, its tests/ folder’s tests, and the examples in its doc comments, and runs them, in parallel, in one process. With no file or folder, it works on the package the current folder is in: the nearest folder, from the current one up, with a project.toml. fb test std runs the examples in the standard library’s docs.

    Each test’s result is a line, and a summary ends the run:

         Running 3 tests
    test shop.prices.TenthItemIsFree ... ok
    test shop.prices.TakingTooManyThrows ... ok
    test shop.prices.Total (example) ... ok
    
    test result: ok. 3 passed; 0 failed; 0 skipped; 0 filtered out; finished in 0.02s

    A test that panics doesn’t stop the others: fb starts the process again and runs the ones left. In a debug build, each test’s leaks are reported with it. fb exits with 1 when a test failed.

    Options

    Option
    --filter <name>Runs only the tests whose names have <name> in them
    --releaseOptimizes, and lets integer overflow wrap instead of panicking
    --offlineUses only the registry packages in the cache
    --color <when>Colors the output: auto, always, or never

    Examples

    fb test
    fb test --filter prices
    fb test --release

    Testing covers @Test, Expect, and doc tests.

    Report an issue with this page or with FutureBlitz on GitHub.