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.02sA 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 |
--release | Optimizes, and lets integer overflow wrap instead of panicking |
--offline | Uses 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 --releaseTesting covers @Test, Expect, and doc tests.
Report an issue with this page or with FutureBlitz on GitHub.