Skip to content

Commit

Permalink
Add tests for allowed non-backticked identifiers in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Kestrer committed Sep 2, 2020
1 parent b304221 commit 22c9940
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 deletions.
13 changes: 10 additions & 3 deletions tests/ui/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ fn test_emphasis() {
fn test_units() {
}

/// This tests allowed identifiers.
/// DirectX
/// ECMAScript
/// OAuth GraphQL
/// TeX LaTeX BibTeX BibLaTeX
/// CamelCase (see also #2395)
/// be_sure_we_got_to_the_end_of_it
fn test_allowed() {
}

/// This test has [a link_with_underscores][chunked-example] inside it. See #823.
/// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
Expand Down Expand Up @@ -168,9 +178,6 @@ fn issue_1920() {}
/// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
fn issue_1832() {}

/// Ok: CamelCase (It should not be surrounded by backticks)
fn issue_2395() {}

/// An iterator over mycrate::Collection's values.
/// It should not lint a `'static` lifetime in ticks.
fn issue_2210() {}
Expand Down
50 changes: 28 additions & 22 deletions tests/ui/doc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -54,131 +54,137 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:58:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `link_with_underscores` between ticks in the documentation
--> $DIR/doc.rs:52:22
--> $DIR/doc.rs:62:22
|
LL | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
| ^^^^^^^^^^^^^^^^^^^^^

error: you should put `inline_link2` between ticks in the documentation
--> $DIR/doc.rs:55:21
--> $DIR/doc.rs:65:21
|
LL | /// It can also be [inline_link2].
| ^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:65:5
--> $DIR/doc.rs:75:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:73:8
--> $DIR/doc.rs:83:8
|
LL | /// ## CamelCaseThing
| ^^^^^^^^^^^^^^

error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:76:7
--> $DIR/doc.rs:86:7
|
LL | /// # CamelCaseThing
| ^^^^^^^^^^^^^^

error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:78:22
--> $DIR/doc.rs:88:22
|
LL | /// Not a title #897 CamelCaseThing
| ^^^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:79:5
--> $DIR/doc.rs:89:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:86:5
--> $DIR/doc.rs:96:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:99:5
--> $DIR/doc.rs:109:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `FooBar` between ticks in the documentation
--> $DIR/doc.rs:110:43
--> $DIR/doc.rs:120:43
|
LL | /** E.g., serialization of an empty list: FooBar
| ^^^^^^

error: you should put `BarQuz` between ticks in the documentation
--> $DIR/doc.rs:115:5
--> $DIR/doc.rs:125:5
|
LL | And BarQuz too.
| ^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:116:1
--> $DIR/doc.rs:126:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `FooBar` between ticks in the documentation
--> $DIR/doc.rs:121:43
--> $DIR/doc.rs:131:43
|
LL | /** E.g., serialization of an empty list: FooBar
| ^^^^^^

error: you should put `BarQuz` between ticks in the documentation
--> $DIR/doc.rs:126:5
--> $DIR/doc.rs:136:5
|
LL | And BarQuz too.
| ^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:127:1
--> $DIR/doc.rs:137:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:138:5
--> $DIR/doc.rs:148:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:165:13
--> $DIR/doc.rs:175:13
|
LL | /// Not ok: http://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^

error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:166:13
--> $DIR/doc.rs:176:13
|
LL | /// Not ok: https://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^^

error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:167:13
--> $DIR/doc.rs:177:13
|
LL | /// Not ok: http://www.unicode.org/
| ^^^^^^^^^^^^^^^^^^^^^^

error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:168:13
--> $DIR/doc.rs:178:13
|
LL | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: you should put `mycrate::Collection` between ticks in the documentation
--> $DIR/doc.rs:174:22
--> $DIR/doc.rs:181:22
|
LL | /// An iterator over mycrate::Collection's values.
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to 30 previous errors
error: aborting due to 31 previous errors

0 comments on commit 22c9940

Please sign in to comment.