Test extension extraction

This commit is contained in:
Benjamin Sago 2015-01-25 13:47:07 +00:00
parent ef4428fab1
commit 628d90fe44

View File

@ -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,