mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
test: Add unit tests for config merging and project name sanitization (#6)
* test: Add unit tests for config merging and project name sanitization * Update src/utils/project.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * test: Update assertion for follow_symlinks in scanner configuration * test: Fix typo in test function name for project info retrieval --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
a0c9d0f9d4
commit
8497800b13
6 changed files with 140 additions and 1 deletions
|
|
@ -12,3 +12,19 @@ pub fn lowercase_ext(path: &std::path::Path) -> Option<&'static str> {
|
|||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lowercase_ext_recognises_known_extensions() {
|
||||
let cases = [
|
||||
("file.rs", Some("rs")),
|
||||
("FILE.RS", Some("rs")),
|
||||
("main.cpp", Some("cpp")),
|
||||
("script.PY",Some("py")),
|
||||
("index.tsx",Some("ts")),
|
||||
("style.css",None), // unsupported
|
||||
];
|
||||
|
||||
for (file, expected) in cases {
|
||||
assert_eq!(lowercase_ext(std::path::Path::new(file)), expected, "case: {file}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue