fix clippy warning

This commit is contained in:
Kiril Videlov 2024-04-16 19:11:42 +02:00
parent 8ae62e3dad
commit 17ae8eb119
No known key found for this signature in database

View File

@ -4192,34 +4192,6 @@ pub fn apply(base_image: &str, patch: &Patch<'_, str>) -> Result<String> {
}) })
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn joined_test() {
assert!(!joined(1, 2, 3, 4));
assert!(joined(1, 4, 2, 3));
assert!(joined(2, 3, 1, 4));
assert!(!joined(3, 4, 1, 2));
assert!(joined(1, 2, 2, 3));
assert!(joined(1, 3, 2, 3));
assert!(joined(2, 3, 1, 2));
assert!(!joined(1, 1, 2, 2));
assert!(joined(1, 1, 1, 1));
assert!(joined(1, 1, 1, 2));
assert!(joined(1, 2, 2, 2));
}
#[test]
fn normalize_branch_name_test() {
assert_eq!(normalize_branch_name("feature/branch"), "feature/branch");
assert_eq!(normalize_branch_name("foo#branch"), "foo#branch");
assert_eq!(normalize_branch_name("foo!branch"), "foo-branch");
}
}
// Goes through a set of changes and checks if conflicts are present. If no conflicts // Goes through a set of changes and checks if conflicts are present. If no conflicts
// are present in a file it will be resolved, meaning it will be removed from the // are present in a file it will be resolved, meaning it will be removed from the
// conflicts file. // conflicts file.
@ -4247,3 +4219,31 @@ fn update_conflict_markers(
} }
Ok(()) Ok(())
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn joined_test() {
assert!(!joined(1, 2, 3, 4));
assert!(joined(1, 4, 2, 3));
assert!(joined(2, 3, 1, 4));
assert!(!joined(3, 4, 1, 2));
assert!(joined(1, 2, 2, 3));
assert!(joined(1, 3, 2, 3));
assert!(joined(2, 3, 1, 2));
assert!(!joined(1, 1, 2, 2));
assert!(joined(1, 1, 1, 1));
assert!(joined(1, 1, 1, 2));
assert!(joined(1, 2, 2, 2));
}
#[test]
fn normalize_branch_name_test() {
assert_eq!(normalize_branch_name("feature/branch"), "feature/branch");
assert_eq!(normalize_branch_name("foo#branch"), "foo#branch");
assert_eq!(normalize_branch_name("foo!branch"), "foo-branch");
}
}