Auto merge of #10426 - oli-obk:ui_test, r=Manishearth
Port clippy away from compiletest to ui_test Reasons to do this: * runs completely on stable Rust * is easier to extend with new features * has its own dogfood test suite, so changes can be tested in [the `ui_test` repo](https://github.com/oli-obk/ui_test) * supports dependencies from crates.io without having to manually fiddle with command line flags * supports `ui-cargo`, `ui`, `ui-toml` out of the box, no need to find and run the tests ourselves One thing that is a big difference to `compiletest` is that if a test emits *any* error, you need to mark all of them with `//~ ERROR:` annotations. Since many clippy tests did not have annotations, I changed many lints to be `warn` in their test so that only the `stderr` output is tested. TODO: * [ ] check that this still works as a subtree in the rustc repo changelog: none <!-- changelog_checked --> Note: at present the latest changes needed for clippy are only available as a git dependency, but I expect to publish a new crates.io version soon
This commit is contained in:
commit
15ed281699
272 changed files with 1949 additions and 1455 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue