Add test module for update_lints

This commit is contained in:
Michael Wright
2021-09-18 06:43:39 +02:00
parent 3f804ca6d3
commit 20abbd93f9

View File

@@ -526,6 +526,10 @@ declare_deprecated_lint! {
assert_eq!(expected, result); assert_eq!(expected, result);
} }
#[cfg(test)]
mod tests {
use super::*;
#[test] #[test]
fn test_replace_region() { fn test_replace_region() {
let text = "\nabc\n123\n789\ndef\nghi"; let text = "\nabc\n123\n789\ndef\nghi";
@@ -667,7 +671,8 @@ fn test_gen_modules_list() {
Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), Lint::new("should_assert_eq", "group1", "abc", None, "module_name"),
Lint::new("incorrect_stuff", "group3", "abc", None, "another_module"), Lint::new("incorrect_stuff", "group3", "abc", None, "another_module"),
]; ];
let expected = GENERATED_FILE_COMMENT.to_string() + &["mod another_module;", "mod module_name;"].join("\n") + "\n"; let expected =
GENERATED_FILE_COMMENT.to_string() + &["mod another_module;", "mod module_name;"].join("\n") + "\n";
assert_eq!(expected, gen_modules_list(lints.iter())); assert_eq!(expected, gen_modules_list(lints.iter()));
} }
@@ -693,3 +698,4 @@ fn test_gen_lint_group_list() {
assert_eq!(expected, result); assert_eq!(expected, result);
} }
}