summaryrefslogtreecommitdiffstats
path: root/src/icon.rs
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-06-16 12:43:08 +0200
committerrabite <rabite@posteo.de>2019-06-16 12:43:08 +0200
commit48cbbf3b8850992d23bf822be46144fbf0e443b5 (patch)
treedf17921997404d2837f88b5352ba25da6bc2b00f /src/icon.rs
parent8f5ad6b3c947fa058d34a749135e0cdcfd87304b (diff)
some small clean-ups
Diffstat (limited to 'src/icon.rs')
-rw-r--r--src/icon.rs115
1 files changed, 0 insertions, 115 deletions
diff --git a/src/icon.rs b/src/icon.rs
index f261d1c..9916804 100644
--- a/src/icon.rs
+++ b/src/icon.rs
@@ -278,118 +278,3 @@ impl Icons {
m
}
}
-
-#[cfg(test)]
-mod test {
- use super::{Icons, Theme, ICON_SPACE};
- use crate::meta::Meta;
- use std::fs::File;
- use tempdir::TempDir;
-
- #[test]
- fn get_no_icon() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
- let file_path = tmp_dir.path().join("file.txt");
- File::create(&file_path).expect("failed to create file");
- let meta = Meta::from_path(&file_path).unwrap();
-
- let icon = Icons::new(Theme::NoIcon);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, "");
- }
-
- #[test]
- fn get_default_file_icon() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
- let file_path = tmp_dir.path().join("file");
- File::create(&file_path).expect("failed to create file");
- let meta = Meta::from_path(&file_path).unwrap();
-
- let icon = Icons::new(Theme::Fancy);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", "\u{f016}", ICON_SPACE)); // 
- }
-
- #[test]
- fn get_default_file_icon_unicode() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
- let file_path = tmp_dir.path().join("file");
- File::create(&file_path).expect("failed to create file");
- let meta = Meta::from_path(&file_path).unwrap();
-
- let icon = Icons::new(Theme::Unicode);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", "\u{1f5cb}", ICON_SPACE));
- }
-
- #[test]
- fn get_directory_icon() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
- let file_path = tmp_dir.path();
- let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
-
- let icon = Icons::new(Theme::Fancy);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", "\u{f115}", ICON_SPACE)); // 
- }
-
- #[test]
- fn get_directory_icon_unicode() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
- let file_path = tmp_dir.path();
- let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
-
- let icon = Icons::new(Theme::Unicode);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", "\u{1f5c1}", ICON_SPACE));
- }
-
- #[test]
- fn get_directory_icon_with_ext() {
- let tmp_dir = TempDir::new("test_file_type.rs").expect("failed to create temp dir");
- let file_path = tmp_dir.path();
- let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
-
- let icon = Icons::new(Theme::Fancy);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", "\u{f115}", ICON_SPACE)); // 
- }
-
- #[test]
- fn get_icon_by_name() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
-
- for (file_name, file_icon) in &Icons::get_default_icons_by_name() {
- let file_path = tmp_dir.path().join(file_name);
- File::create(&file_path).expect("failed to create file");
- let meta = Meta::from_path(&file_path).unwrap();
-
- let icon = Icons::new(Theme::Fancy);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", file_icon, ICON_SPACE));
- }
- }
-
- #[test]
- fn get_icon_by_extension() {
- let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
-
- for (ext, file_icon) in &Icons::get_default_icons_by_extension() {
- let file_path = tmp_dir.path().join(format!("file.{}", ext));
- File::create(&file_path).expect("failed to create file");
- let meta = Meta::from_path(&file_path).unwrap();
-
- let icon = Icons::new(Theme::Fancy);
- let icon = icon.get(&meta.name);
-
- assert_eq!(icon, format!("{}{}", file_icon, ICON_SPACE));
- }
- }
-}