Rename ignore test fns

This commit is contained in:
Félix Saparelli 2021-07-17 01:33:39 +12:00
parent 54ac2e9ae0
commit 847520357c
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
2 changed files with 26 additions and 26 deletions

View File

@ -254,35 +254,35 @@ mod tests {
}
#[test]
fn test_matches_exact() {
fn matches_exact() {
let file = build_gitignore("Cargo.toml");
assert!(file.is_excluded(&base_dir().join("Cargo.toml")));
}
#[test]
fn test_does_not_match() {
fn does_not_match() {
let file = build_gitignore("Cargo.toml");
assert!(!file.is_excluded(&base_dir().join("src").join("main.rs")));
}
#[test]
fn test_matches_simple_wildcard() {
fn matches_simple_wildcard() {
let file = build_gitignore("targ*");
assert!(file.is_excluded(&base_dir().join("target")));
}
#[test]
fn test_matches_subdir_exact() {
fn matches_subdir_exact() {
let file = build_gitignore("target");
assert!(file.is_excluded(&base_dir().join("target/")));
}
#[test]
fn test_matches_subdir() {
fn matches_subdir() {
let file = build_gitignore("target");
assert!(file.is_excluded(&base_dir().join("target").join("file")));
@ -290,7 +290,7 @@ mod tests {
}
#[test]
fn test_wildcard_with_dir() {
fn wildcard_with_dir() {
let file = build_gitignore("target/f*");
assert!(file.is_excluded(&base_dir().join("target").join("file")));
@ -298,7 +298,7 @@ mod tests {
}
#[test]
fn test_leading_slash() {
fn leading_slash() {
let file = build_gitignore("/*.c");
assert!(file.is_excluded(&base_dir().join("cat-file.c")));
@ -306,7 +306,7 @@ mod tests {
}
#[test]
fn test_leading_double_wildcard() {
fn leading_double_wildcard() {
let file = build_gitignore("**/foo");
assert!(file.is_excluded(&base_dir().join("foo")));
@ -315,7 +315,7 @@ mod tests {
}
#[test]
fn test_trailing_double_wildcard() {
fn trailing_double_wildcard() {
let file = build_gitignore("abc/**");
assert!(!file.is_excluded(&base_dir().join("def").join("foo")));
@ -324,7 +324,7 @@ mod tests {
}
#[test]
fn test_sandwiched_double_wildcard() {
fn sandwiched_double_wildcard() {
let file = build_gitignore("a/**/b");
assert!(file.is_excluded(&base_dir().join("a").join("b")));
@ -333,7 +333,7 @@ mod tests {
}
#[test]
fn test_empty_file_never_excludes() {
fn empty_file_never_excludes() {
let file =
GitignoreFile::from_strings(&[], &base_dir()).expect("test gitignore file invalid");
@ -341,7 +341,7 @@ mod tests {
}
#[test]
fn test_checks_all_patterns() {
fn checks_all_patterns() {
let patterns = vec!["target", "target2"];
let file = GitignoreFile::from_strings(&patterns, &base_dir())
.expect("test gitignore file invalid");
@ -351,7 +351,7 @@ mod tests {
}
#[test]
fn test_handles_whitelisting() {
fn handles_negative_patterns() {
let patterns = vec!["target", "!target/foo.txt"];
let file = GitignoreFile::from_strings(&patterns, &base_dir())
.expect("test gitignore file invalid");

View File

@ -259,35 +259,35 @@ mod tests {
}
#[test]
fn test_matches_exact() {
fn matches_exact() {
let file = build_ignore("Cargo.toml");
assert!(file.is_excluded(&base_dir().join("Cargo.toml")));
}
#[test]
fn test_does_not_match() {
fn does_not_match() {
let file = build_ignore("Cargo.toml");
assert!(!file.is_excluded(&base_dir().join("src").join("main.rs")));
}
#[test]
fn test_matches_simple_wildcard() {
fn matches_simple_wildcard() {
let file = build_ignore("targ*");
assert!(file.is_excluded(&base_dir().join("target")));
}
#[test]
fn test_matches_subdir_exact() {
fn matches_subdir_exact() {
let file = build_ignore("target");
assert!(file.is_excluded(&base_dir().join("target/")));
}
#[test]
fn test_matches_subdir() {
fn matches_subdir() {
let file = build_ignore("target");
assert!(file.is_excluded(&base_dir().join("target").join("file")));
@ -295,7 +295,7 @@ mod tests {
}
#[test]
fn test_wildcard_with_dir() {
fn wildcard_with_dir() {
let file = build_ignore("target/f*");
assert!(file.is_excluded(&base_dir().join("target").join("file")));
@ -303,7 +303,7 @@ mod tests {
}
#[test]
fn test_leading_slash() {
fn leading_slash() {
let file = build_ignore("/*.c");
assert!(file.is_excluded(&base_dir().join("cat-file.c")));
@ -311,7 +311,7 @@ mod tests {
}
#[test]
fn test_leading_double_wildcard() {
fn leading_double_wildcard() {
let file = build_ignore("**/foo");
assert!(file.is_excluded(&base_dir().join("foo")));
@ -320,7 +320,7 @@ mod tests {
}
#[test]
fn test_trailing_double_wildcard() {
fn trailing_double_wildcard() {
let file = build_ignore("abc/**");
assert!(!file.is_excluded(&base_dir().join("def").join("foo")));
@ -329,7 +329,7 @@ mod tests {
}
#[test]
fn test_sandwiched_double_wildcard() {
fn sandwiched_double_wildcard() {
let file = build_ignore("a/**/b");
assert!(file.is_excluded(&base_dir().join("a").join("b")));
@ -338,14 +338,14 @@ mod tests {
}
#[test]
fn test_empty_file_never_excludes() {
fn empty_file_never_excludes() {
let file = IgnoreFile::from_strings(&[], &base_dir()).expect("test ignore file invalid");
assert!(!file.is_excluded(&base_dir().join("target")));
}
#[test]
fn test_checks_all_patterns() {
fn checks_all_patterns() {
let patterns = vec!["target", "target2"];
let file =
IgnoreFile::from_strings(&patterns, &base_dir()).expect("test ignore file invalid");
@ -355,7 +355,7 @@ mod tests {
}
#[test]
fn test_handles_whitelisting() {
fn handles_whitelisting() {
let patterns = vec!["target", "!target/foo.txt"];
let file =
IgnoreFile::from_strings(&patterns, &base_dir()).expect("test ignore file invalid");