Skip to content

Commit

Permalink
core: Remove legacy tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
luleyleo committed Sep 6, 2024
1 parent 42f7689 commit 7d511c1
Showing 1 changed file with 0 additions and 68 deletions.
68 changes: 0 additions & 68 deletions core/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,71 +313,3 @@ fn message_receiver(
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn find_names() {
let file1 = add_demo_file();

let (s, r) = flume::unbounded();
let man = Manager::new(s);
let search = Search {
directory: file1.parent().unwrap().to_owned(),
pattern: "41".to_string(),
};
println!("using search {search:?}");
man.search(&search);

//first get interim
let mess = r.recv();
println!("mess {mess:?}");
if let Ok(mess) = mess {
println!("{mess:?}");
match mess {
SearchResult::InterimResult(fi) => {
assert_eq!(fi.matches.len(), 1);
}
_ => panic!("should be interim"),
}
}

let mess = r.recv();
println!("mess {mess:?}");
if let Ok(mess) = mess {
println!("{mess:?}");
match mess {
SearchResult::FinalResults(fr) => {
assert_eq!(fr.data.len(), 1);
}
_ => panic!("should be final"),
}
}
}

fn add_demo_file() -> PathBuf {
let mut dir = std::env::temp_dir();
println!("Using Temporary directory: {}", dir.display());

//create new directory in here, and create a file with the relevant text
dir.push("rusltestdir");
if dir.exists() {
let _ = std::fs::remove_dir_all(&dir);
}
if std::fs::create_dir_all(&dir).is_err() {
panic!("could not create temp dir");
}

let mut file1 = dir.clone();
file1.push("temp.csv");

if std::fs::write(&file1, "hello\nthere 41 go").is_err() {
panic!("could not create file");
} else {
println!("writing to {file1:?}")
}
file1
}
}

0 comments on commit 7d511c1

Please sign in to comment.