Skip to content

Commit

Permalink
Moving tests to ui-toml to make use of clippy.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown authored and unknown committed Feb 1, 2019
1 parent 7fbd55c commit 3a97b5f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 178 deletions.
1 change: 1 addition & 0 deletions tests/ui-toml/functions_maxlines/clippy.toml
@@ -0,0 +1 @@
too-many-lines-threshold = 1
44 changes: 44 additions & 0 deletions tests/ui-toml/functions_maxlines/test.rs
@@ -0,0 +1,44 @@
#![warn(clippy::too_many_lines)]


// This function should be considered one line.
fn many_comments_but_one_line_of_code() {
/* println!("This is good."); */
// println!("This is good.");
/* */ // println!("This is good.");
/* */ // println!("This is good.");
/* */ // println!("This is good.");
/* */ // println!("This is good.");
/* println!("This is good.");
println!("This is good.");
println!("This is good."); */
println!("This is good.");
}

// This should be considered two and a fail.
fn too_many_lines() {
println!("This is bad.");
println!("This is bad.");
}

// This should be considered one line.
fn comment_starts_after_code() {
let _ = 5; /* closing comment. */ /*
this line shouldn't be counted theoretically.
*/
}

// This should be considered one line.
fn comment_after_code() {
let _ = 5; /* this line should get counted once. */
}

// This should fail since it is technically two lines.
fn comment_before_code() {
let _ = "test";
/* This comment extends to the front of
teh code but this line should still count. */ let _ = 5;
}

// This should be considered one line.
fn main() {}
23 changes: 23 additions & 0 deletions tests/ui-toml/functions_maxlines/test.stderr
@@ -0,0 +1,23 @@
error: This function has a large number of lines.
--> $DIR/test.rs:19:1
|
LL | / fn too_many_lines() {
LL | | println!("This is bad.");
LL | | println!("This is bad.");
LL | | }
| |_^
|
= note: `-D clippy::too-many-lines` implied by `-D warnings`

error: This function has a large number of lines.
--> $DIR/test.rs:37:1
|
LL | / fn comment_before_code() {
LL | | let _ = "test";
LL | | /* This comment extends to the front of
LL | | teh code but this line should still count. */ let _ = 5;
LL | | }
| |_^

error: aborting due to 2 previous errors

162 changes: 0 additions & 162 deletions tests/ui/functions_maxlines.rs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/functions_maxlines.stderr

This file was deleted.

0 comments on commit 3a97b5f

Please sign in to comment.