Port clippy away from compiletest to ui_test

This commit is contained in:
Oli Scherer 2023-02-28 16:12:10 +00:00
parent 78e36d9f53
commit 514b6d04bb
14 changed files with 208 additions and 392 deletions

View file

@ -122,20 +122,17 @@ fn main() {
}
```
Now we can run the test with `TESTNAME=foo_functions cargo uitest`, currently
Now we can run the test with `TESTNAME=foo_functions cargo uibless`, currently
this test is meaningless though.
While we are working on implementing our lint, we can keep running the UI test.
That allows us to check if the output is turning into what we want.
That allows us to check if the output is turning into what we want by checking the
`.stderr` file that gets updated on every test run.
Once we are satisfied with the output, we need to run `cargo dev bless` to
update the `.stderr` file for our lint. Please note that, we should run
`TESTNAME=foo_functions cargo uitest` every time before running `cargo dev
bless`. Running `TESTNAME=foo_functions cargo uitest` should pass then. When we
Running `TESTNAME=foo_functions cargo uitest` should pass on its own. When we
commit our lint, we need to commit the generated `.stderr` files, too. In
general, you should only commit files changed by `cargo dev bless` for the
specific lint you are creating/editing. Note that if the generated files are
empty, they should be removed.
general, you should only commit files changed by `cargo bless` for the
specific lint you are creating/editing.
> _Note:_ you can run multiple test files by specifying a comma separated list:
> `TESTNAME=foo_functions,test2,test3`.
@ -169,7 +166,7 @@ additionally run [rustfix] for that test. Rustfix will apply the suggestions
from the lint to the code of the test file and compare that to the contents of a
`.fixed` file.
Use `cargo dev bless` to automatically generate the `.fixed` file after running
Use `cargo bless` to automatically generate the `.fixed` file while running
the tests.
[rustfix]: https://github.com/rust-lang/rustfix

View file

@ -66,7 +66,7 @@ If the output of a [UI test] differs from the expected output, you can update
the reference file with:
```bash
cargo dev bless
cargo bless
```
For example, this is necessary if you fix a typo in an error message of a lint,