Skip to content

Commit 92be1ac

Browse files
committed
Add section about "Example Output"
1 parent c41dd7c commit 92be1ac

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4552,6 +4552,7 @@ Released 2018-09-13
45524552
[`fn_to_numeric_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast
45534553
[`fn_to_numeric_cast_any`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast_any
45544554
[`fn_to_numeric_cast_with_truncation`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast_with_truncation
4555+
[`foo_functions`]: https://rust-lang.github.io/rust-clippy/master/index.html#foo_functions
45554556
[`for_kv_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_kv_map
45564557
[`for_loop_over_option`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loop_over_option
45574558
[`for_loop_over_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loop_over_result

book/src/development/writing_tests.md

+34
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,40 @@ As we gradually implement our lint logic, we will keep running this UI test comm
8686
Clippy will begin outputting information that allows us to check if the output is
8787
turning into what we want it to be.
8888

89+
### Example output
90+
91+
As our `foo_functions` lint is tested, the output would look something like this:
92+
93+
```
94+
failures:
95+
96+
---- compile_test stdout ----
97+
normalized stderr:
98+
error: function called "foo"
99+
--> $DIR/foo_functions.rs:6:12
100+
|
101+
LL | pub fn foo(&self) {}
102+
| ^^^
103+
|
104+
= note: `-D clippy::foo-functions` implied by `-D warnings`
105+
106+
error: function called "foo"
107+
--> $DIR/foo_functions.rs:13:8
108+
|
109+
LL | fn foo(&self) {}
110+
| ^^^
111+
112+
error: function called "foo"
113+
--> $DIR/foo_functions.rs:19:4
114+
|
115+
LL | fn foo() {}
116+
| ^^^
117+
118+
error: aborting due to 3 previous errors
119+
```
120+
121+
Note the *failures* label at the top of the fragment, we'll get rid of it (saving this output) in the next section.
122+
89123
> _Note:_ You can run multiple test files by specifying a comma separated list:
90124
> `TESTNAME=foo_functions,bar_methods,baz_structs`.
91125
### `cargo dev bless`

0 commit comments

Comments
 (0)