use slotgate::config::module_path::ModulePath;
use std::path::Path;
#[test]
fn of_a_file_directly_under_the_root_is_its_stem() {
let module = ModulePath::of(Path::new("tests"), Path::new("tests/widget_tests.rs"));
assert_eq!(module, "widget_tests");
}
#[test]
fn of_a_mod_file_names_its_directory_and_not_itself() {
let module = ModulePath::of(Path::new("tests"), Path::new("tests/cluster/mod.rs"));
assert_eq!(module, "cluster");
}
#[test]
fn of_a_nested_file_joins_every_directory_below_the_root() {
let module = ModulePath::of(
Path::new("tests"),
Path::new("tests/cluster/recovery/retention_tests.rs"),
);
assert_eq!(module, "cluster::recovery::retention_tests");
}
#[test]
fn of_a_root_that_is_the_file_itself_is_that_files_stem() {
let path = Path::new("tests/widget_tests.rs");
let module = ModulePath::of(path, path);
assert_eq!(module, "widget_tests");
}