mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-18 18:00:35 +01:00
Add tests for strip_current_dir
This commit is contained in:
parent
556c40e1f4
commit
6e96154d86
1 changed files with 21 additions and 0 deletions
|
@ -92,3 +92,24 @@ pub fn strip_current_dir(pathbuf: &PathBuf) -> &Path {
|
|||
}
|
||||
iter.as_path()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn strip_current_dir_basic() {
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use super::strip_current_dir;
|
||||
|
||||
assert_eq!(strip_current_dir(&PathBuf::from("./foo")), Path::new("foo"));
|
||||
assert_eq!(strip_current_dir(&PathBuf::from("foo")), Path::new("foo"));
|
||||
assert_eq!(
|
||||
strip_current_dir(&PathBuf::from("./foo/bar/baz")),
|
||||
Path::new("foo/bar/baz")
|
||||
);
|
||||
assert_eq!(
|
||||
strip_current_dir(&PathBuf::from("foo/bar/baz")),
|
||||
Path::new("foo/bar/baz")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue