refactor: reorganize source and tests
This commit is contained in:
1 parent
15d76c18a0
commit
c6205a337c
139 files changed
+5532
-5548
No files matched your search
+2
-37
@@ -116,40 +116,5 @@ fn toggle_entry(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::find_entry_by_stem;
|
||||
use crate::instance::ContentEntry;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn entry(file_stem: &str) -> ContentEntry {
|
||||
ContentEntry {
|
||||
file_stem: file_stem.to_string(),
|
||||
name: file_stem.to_string(),
|
||||
source_slug: None,
|
||||
installed_path: None,
|
||||
provider_project: None,
|
||||
title_suffix: None,
|
||||
footer_label: None,
|
||||
description: String::new(),
|
||||
enabled: true,
|
||||
icon_bytes: None,
|
||||
provider_icon: false,
|
||||
provider_description: false,
|
||||
path: PathBuf::from(file_stem),
|
||||
icon_lines: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matches_by_stem_case_insensitively() {
|
||||
let entries = vec![entry("Sodium"), entry("Lithium")];
|
||||
let found = find_entry_by_stem(&entries, "sOdIuM").expect("entry should match");
|
||||
assert_eq!(found.file_stem, "Sodium");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returns_none_for_missing_stem() {
|
||||
let entries = vec![entry("Sodium")];
|
||||
assert!(find_entry_by_stem(&entries, "iris").is_none());
|
||||
}
|
||||
}
|
||||
#[path = "tests/content.rs"]
|
||||
mod tests;
|
||||
Reference in new issue
Block a user