Skip to content

Commit

Permalink
fix: use HashMap instead of a special struct for IconTheme#name,exten…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
sudame committed Jan 23, 2023
1 parent 0600352 commit 5e81871
Show file tree
Hide file tree
Showing 2 changed files with 522 additions and 552 deletions.
7 changes: 3 additions & 4 deletions src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ impl Icons {

#[cfg(test)]
mod test {
use super::Icons;
use super::{IconTheme, Icons};
use crate::flags::{IconOption, IconTheme as FlagTheme};
use crate::meta::Meta;
use crate::theme::icon::ByFilename;
use std::fs::File;
use tempfile::tempdir;

Expand Down Expand Up @@ -208,7 +207,7 @@ mod test {
fn get_icon_by_name() {
let tmp_dir = tempdir().expect("failed to create temp dir");

for (file_name, file_icon) in ByFilename::default_name() {
for (file_name, file_icon) in &IconTheme::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, false).unwrap();
Expand All @@ -224,7 +223,7 @@ mod test {
fn get_icon_by_extension() {
let tmp_dir = tempdir().expect("failed to create temp dir");

for (ext, file_icon) in ByFilename::default_extension() {
for (ext, file_icon) in &IconTheme::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, false).unwrap();
Expand Down
Loading

0 comments on commit 5e81871

Please sign in to comment.