From 7d511c1c48df613cf85e68764e7f57c895462748 Mon Sep 17 00:00:00 2001 From: Leopold Luley Date: Fri, 6 Sep 2024 12:34:44 +0200 Subject: [PATCH] core: Remove legacy tests. --- core/src/manager.rs | 68 --------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/core/src/manager.rs b/core/src/manager.rs index 16587e4..629b06f 100644 --- a/core/src/manager.rs +++ b/core/src/manager.rs @@ -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 - } -}