提交 628d90fe 编写于 作者: B Benjamin Sago

Test extension extraction

上级 ef4428fa
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册