fix: stabilize directory output order
This commit is contained in:
parent
c763b3e664
commit
27b4d70962
|
|
@ -27,6 +27,7 @@ impl WalkDocuments {
|
|||
entries: WalkDir::new(root)
|
||||
.follow_links(false)
|
||||
.max_depth(limits.max_walk_depth)
|
||||
.sort_by_file_name()
|
||||
.into_iter(),
|
||||
limits: limits.clone(),
|
||||
}
|
||||
|
|
|
|||
19
tests/cli.rs
19
tests/cli.rs
|
|
@ -224,6 +224,25 @@ fn multiple_files_and_findings_keep_requested_and_span_order() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn directory_output_is_sorted_by_path() {
|
||||
let directory = tempdir().unwrap();
|
||||
let later = directory.path().join("z-later.txt");
|
||||
let earlier = directory.path().join("a-earlier.txt");
|
||||
fs::write(&later, "later").unwrap();
|
||||
fs::write(&earlier, "earlier").unwrap();
|
||||
|
||||
let output = detector()
|
||||
.args(["--output", "json"])
|
||||
.arg(directory.path())
|
||||
.output()
|
||||
.unwrap();
|
||||
let records = json_records(&output);
|
||||
|
||||
assert_eq!(records[0]["source"], earlier.display().to_string());
|
||||
assert_eq!(records[1]["source"], later.display().to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_path_does_not_hide_a_later_document() {
|
||||
let directory = tempdir().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in New Issue