mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +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
|
|
@ -105,9 +105,9 @@ fn scan_filesystem(root: &Path, cfg: &Config) -> NyxResult<Vec<Diag>> {
|
|||
|
||||
let mut diags = acc.into_inner()?;
|
||||
if let Some(max) = cfg.output.max_results {
|
||||
diags.truncate(max as usize);
|
||||
diags.truncate(max as usize);
|
||||
}
|
||||
|
||||
|
||||
Ok(diags)
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ pub fn scan_with_index_parallel(
|
|||
let idx = Indexer::from_pool(project, &pool)?;
|
||||
idx.get_files(project)?
|
||||
};
|
||||
|
||||
|
||||
let diag_map: DashMap<String, Vec<Diag>> = DashMap::new();
|
||||
|
||||
files.into_par_iter().for_each_init(
|
||||
|
|
@ -156,12 +156,12 @@ pub fn scan_with_index_parallel(
|
|||
|
||||
// Optional, heavy: only vacuum on --rebuild-index
|
||||
// if rebuild { idx.vacuum()?; }
|
||||
|
||||
|
||||
let mut diags: Vec<Diag> = diag_map.into_iter().flat_map(|(_, v)| v).collect();
|
||||
|
||||
if let Some(max) = cfg.output.max_results {
|
||||
diags.truncate(max as usize);
|
||||
}
|
||||
|
||||
|
||||
Ok(diags)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue