mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-25 01:46:02 +00:00
Test extension extraction
This commit is contained in:
parent
ef4428fab1
commit
628d90fe44
16
src/file.rs
16
src/file.rs
@ -378,7 +378,6 @@ fn ext<'a>(name: &'a str) -> Option<String> {
|
||||
name.rfind('.').map(|p| name[p+1..].to_string())
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
pub use super::*;
|
||||
@ -390,6 +389,21 @@ mod test {
|
||||
pub use ansi_term::Style::Plain;
|
||||
pub use ansi_term::Colour::Yellow;
|
||||
|
||||
#[test]
|
||||
fn extension() {
|
||||
assert_eq!(Some("dat".to_string()), super::ext("fester.dat"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dotfile() {
|
||||
assert_eq!(Some("vimrc".to_string()), super::ext(".vimrc"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_extension() {
|
||||
assert_eq!(None, super::ext("jarlsberg"))
|
||||
}
|
||||
|
||||
pub fn dummy_stat() -> io::FileStat {
|
||||
io::FileStat {
|
||||
size: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user