2018-03-29 14:14:53 -05:00
|
|
|
extern crate clippy_lints;
|
|
|
|
use clippy_lints::utils::without_block_comments;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_lines_without_block_comments() {
|
|
|
|
let result = without_block_comments(vec!["/*", "", "*/"]);
|
|
|
|
println!("result: {:?}", result);
|
|
|
|
assert!(result.is_empty());
|
|
|
|
|
2018-05-22 03:21:42 -05:00
|
|
|
let result = without_block_comments(vec!["", "/*", "", "*/", "#[crate_type = \"lib\"]", "/*", "", "*/", ""]);
|
2018-03-29 14:14:53 -05:00
|
|
|
assert_eq!(result, vec!["", "#[crate_type = \"lib\"]", ""]);
|
|
|
|
|
|
|
|
let result = without_block_comments(vec!["/* rust", "", "*/"]);
|
|
|
|
assert!(result.is_empty());
|
|
|
|
|
2018-03-30 05:36:30 -05:00
|
|
|
let result = without_block_comments(vec!["/* one-line comment */"]);
|
|
|
|
assert!(result.is_empty());
|
|
|
|
|
2018-05-22 03:21:42 -05:00
|
|
|
let result = without_block_comments(vec!["/* nested", "/* multi-line", "comment", "*/", "test", "*/"]);
|
2018-03-30 05:36:30 -05:00
|
|
|
assert!(result.is_empty());
|
|
|
|
|
|
|
|
let result = without_block_comments(vec!["/* nested /* inline /* comment */ test */ */"]);
|
|
|
|
assert!(result.is_empty());
|
|
|
|
|
2018-03-29 14:14:53 -05:00
|
|
|
let result = without_block_comments(vec!["foo", "bar", "baz"]);
|
|
|
|
assert_eq!(result, vec!["foo", "bar", "baz"]);
|
|
|
|
}
|