mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-21 20:18:06 +02:00
test: Add unit tests for file handling and configuration merging (#7)
* test: Add unit tests for file handling and configuration merging * test: Update IO error conversion test to use new error creation method
This commit is contained in:
parent
8497800b13
commit
46c4732f6e
8 changed files with 225 additions and 57 deletions
20
src/walk.rs
20
src/walk.rs
|
|
@ -105,3 +105,23 @@ pub fn spawn_senders(root: &Path, cfg: &Config) -> Receiver<Batch> {
|
|||
|
||||
rx
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn walker_respects_excluded_extensions() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
std::fs::write(tmp.path().join("keep.rs"), "fn main(){}").unwrap();
|
||||
std::fs::write(tmp.path().join("skip.txt"), "ignored").unwrap();
|
||||
|
||||
let mut cfg = Config::default();
|
||||
cfg.scanner.excluded_extensions = vec!["txt".into()];
|
||||
cfg.performance.worker_threads = Some(1);
|
||||
cfg.performance.channel_multiplier = 1;
|
||||
cfg.performance.batch_size = 2;
|
||||
|
||||
let rx = spawn_senders(tmp.path(), &cfg);
|
||||
|
||||
let all: Vec<_> = rx.into_iter().flatten().collect();
|
||||
|
||||
assert!(all.iter().any(|p| p.ends_with("keep.rs")));
|
||||
assert!(all.iter().all(|p| !p.ends_with("skip.txt")));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue