Top level directory structure:
src: Testing code.typ: Input files. The tests incompilerspecifically test the compiler while the others test the standard library (but also the compiler indirectly).ref: Reference images which the output is compared with to determine whether a test passed or failed.png: PNG files produced by tests.pdf: PDF files produced by tests.
Running all tests (including unit tests):
cargo test --allRunning just the integration tests (the tests in this directory):
cargo test --all --test testsYou may want to make yourself an alias like:
testitRunning all tests whose paths contain the string page or stack.
testit page stackRunning a test with the exact filename page.typ.
testit --exact page.typDebug-printing the layout trees for all executed tests.
testit --debug empty.typTo make the integration tests go faster they don't generate PDFs by default.
Pass the --pdf flag to generate those. Mind that PDFs are not tested
automatically at the moment, so you should always check the output manually when
making changes.
testit --pdfTo keep things small, please optimize reference images before committing them.
When you use the approve button from the Test Helper (see the tools folder)
this happens automatically if you have oxipng installed.
# One image
oxipng -o max path/to/image.png
# All images
oxipng -r -o max tests/refIf you want to have a quicker way to run the tests, consider adding a shortcut to your shell profile so that you can simply write something like:
testit empty.typOpen your Bash configuration by executing nano ~/.bashrc.
alias testit="cargo test --all --test tests --"Open your PowerShell profile by executing notepad $profile.
function testit {
cargo test --all --test tests -- $args
}