Tests are split into two parts:
- Unit tests, run by running
cargo test
in the root directory. - Integration tests (containing usages of the proc macro and ui-tests):
(cd test-crates && cargo test)
You can run both of these with just test
(see just) for more information. Just is not required to contribute but may save you a small amount of time.
The UI tests are currently tested against Rust 1.79.0
To run a single test set the TESTNAME environment variable. For example:
TESTNAME=log_global_ref_and_chained_calls just test
Duchess looks for the DUCHESS_DEBUG
environment variable during proc-macro expansion and build.rs
execution. When this variable is set, if it is true
or 1
, all generated code will be formatted and dumped to a directory. Additionally, this emits output from the buildscript as warning
lines for cargo so they become visible.
For proc macro expansion, clickable links are printed to stderr:
For example:
file:////var/folders/20/gm3mpm1n6lj3r3tb6q2hx2_80000gr/T/.tmpjJadBD/auth_Authenticated.rs
file:////var/folders/20/gm3mpm1n6lj3r3tb6q2hx2_80000gr/T/.tmpjJadBD/auth_AuthorizeRequest.rs
file:////var/folders/20/gm3mpm1n6lj3r3tb6q2hx2_80000gr/T/.tmpjJadBD/auth_HttpAuth.rs
If you want to filter specific Java class paths, you can pass a string like auth
or java.lang
:
DUCHESS_DEBUG=java.lang
This will only dump debug information for these specific classes.