| Crates.io | dylint_uitesting |
| lib.rs | dylint_uitesting |
| version | 5.0.0 |
| created_at | 2025-11-03 02:49:52.619343+00 |
| updated_at | 2025-11-03 02:49:52.619343+00 |
| description | Better UI testing for dylint libraries with ui_test |
| homepage | |
| repository | https://github.com/dra11y/dylint_uitesting |
| max_upload_size | |
| id | 1913816 |
| size | 85,832 |
This crate provides convenient access to the [compiletest_rs] package for testing Dylint
libraries.
Note: If your test has dependencies, you must use ui_test_example or ui_test_examples.
See the question_mark_in_expression example in this repository.
This crate provides the following three functions:
ui_test - test a library on all source files in a directoryui_test_example - test a library on one example targetui_test_examples - test a library on all example targetsFor most situations, you can add the following to your library's lib.rs file:
#[test]
fn ui() {
dylint_testing::ui_test(env!("CARGO_PKG_NAME"), "ui");
}
And include one or more .rs and .stderr files in a ui directory alongside your library's
src directory. See the examples in this repository.
In addition to the above three functions, ui::Test is a test "builder." Currently, the main
advantage of using Test over the above functions is that Test allows flags to be passed to
rustc. For an example of its use, see non_thread_safe_call_in_test in this repository.
Test has three constructors, which correspond to the above three functions as follows:
ui::Test::src_base <-> ui_testui::Test::example <-> ui_test_exampleui::Test::examples <-> ui_test_examplesIn each case, the constructor's arguments are exactly those of the corresponding function.
A Test instance has the following methods:
dylint_toml - set the dylint.toml file's contents (for testing configurable libraries)rustc_flags - pass flags to the compiler when running the testexpected_exit_status - set the expected driver exit status (default 101 for dylint_driver)run - run the testcargo test verifies annotations and diffs against .stderr/.stdout. It never writes fixtures.BLESS=1 cargo test performs a two-pass run:
.stderr/.stdout.Exit status: when using the Dylint driver, we accept either exit code 101 (current behavior)
or 1 (future-compatible), so your tests remain stable if upstream changes. Diagnostics are
parsed from stderr; debug driver prefixes are filtered for stable diffs.
This keeps diffs in target/ui during normal runs and only touches fixtures when you explicitly bless.