mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-12 19:55:14 +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
|
|
@ -15,16 +15,20 @@ pub fn lowercase_ext(path: &std::path::Path) -> Option<&'static str> {
|
|||
|
||||
#[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
|
||||
];
|
||||
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}");
|
||||
}
|
||||
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