Make the tests a module
@@ -122,11 +122,14 @@ impl LanguageDefinition {
}
}
-// for testing
#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
pub fn language_for_name() {}
-#[cfg(test)]
+ #[test]
pub fn language_for_path() {
let ld_rust = LanguageDefinition {
name: LanguageId::from("Rust"),
@@ -148,7 +151,10 @@ pub fn language_for_path() {
};
let languages = Languages::new(&[ld_rust.clone(), ld_commit_msg.clone()]);
- assert_eq!(ld_rust.name, languages.language_for_path(Path::new("/path/test.rs")).unwrap().name);
+ assert_eq!(
+ ld_rust.name,
+ languages.language_for_path(Path::new("/path/test.rs")).unwrap().name
+ );
assert_eq!(
ld_commit_msg.name,
languages.language_for_path(Path::new("/path/COMMIT_EDITMSG")).unwrap().name
@@ -162,3 +168,4 @@ pub fn language_for_path() {
languages.language_for_path(Path::new("/path/TAG_EDITMSG")).unwrap().name
);
}
+}
