refactor(build): reformat code and add tonic health dependency
- Reformatted build script with proper indentation and line breaks - Added tonic-health dependency to Cargo.toml and updated lock file - Improved error handling in disk cache with concurrent deletion checks - Refactored conditional chains using && and let expressions - Reformatted struct initialization and function parameter lists - Added proper spacing and alignment in language stats processing - Improved assertion formatting in test cases - Reorganized import statements and code layout in multiple files - Updated metrics functions with better parameter handling and formatting
This commit is contained in:
@@ -7,7 +7,11 @@ use gitks::repository::lang_stats::{EXTENSION_MAP, FILENAME_MAP};
|
||||
fn test_extension_map_lookup() {
|
||||
// Verify .md is in the map
|
||||
let result = EXTENSION_MAP.binary_search_by(|&(e, _, _)| e.cmp(".md"));
|
||||
assert!(result.is_ok(), ".md should be in EXTENSION_MAP, got {:?}", result);
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
".md should be in EXTENSION_MAP, got {:?}",
|
||||
result
|
||||
);
|
||||
let idx = result.unwrap();
|
||||
assert_eq!(EXTENSION_MAP[idx].1, "Markdown");
|
||||
assert_eq!(EXTENSION_MAP[idx].2, "prose");
|
||||
@@ -122,10 +126,7 @@ fn test_language_stats_with_path() {
|
||||
|
||||
// Should NOT find README.md (it's at root level)
|
||||
let md = resp.languages.iter().find(|l| l.language == "Markdown");
|
||||
assert!(
|
||||
md.is_none(),
|
||||
"should not find Markdown in src/ directory"
|
||||
);
|
||||
assert!(md.is_none(), "should not find Markdown in src/ directory");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -145,6 +146,9 @@ fn test_language_stats_line_count_excludes_blank_lines() {
|
||||
let md = resp.languages.iter().find(|l| l.language == "Markdown");
|
||||
if let Some(md) = md {
|
||||
// README.md: "# Test" and "Updated." are non-blank = 2 lines
|
||||
assert!(md.lines >= 2, "should count at least 2 code lines for README.md");
|
||||
assert!(
|
||||
md.lines >= 2,
|
||||
"should count at least 2 code lines for README.md"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user