use crate::cli::doctor::{DoctorArgs, run_to};
fn args(path: &std::path::Path) -> DoctorArgs {
DoctorArgs {
path: path.to_path_buf(),
config: None,
}
}
#[test]
fn languages_found_lists_each_language_in_registration_order() {
let dir = tempfile::tempdir().expect("tempdir");
std::fs::write(dir.path().join("a.py"), "x = 1\n").expect("a.py");
std::fs::write(dir.path().join("b.py"), "y = 2\n").expect("b.py");
std::fs::write(dir.path().join("main.go"), "package main\n").expect("main.go");
let mut out = Vec::new();
let exit = run_to(&mut out, &args(dir.path())).expect("run_to");
assert_eq!(exit, crate::Exit::Clean);
let rendered = String::from_utf8(out).expect("utf8");
let py_idx = rendered
.find(" Python: 2 file(s)")
.expect("Python line must appear");
let go_idx = rendered
.find(" Go: 1 file(s)")
.expect("Go line must appear");
assert!(
py_idx < go_idx,
"Python must appear before Go (registration order); rendered:\n{rendered}"
);
}