Function bodies 251 total
test_request_trash_zero_messages_sets_confirmation function · rust · L900-L908 (9 LOC)src/app.rs
fn test_request_trash_zero_messages_sets_confirmation() {
let mut app = App::with_sessions(vec![make_session("s1", "p1"), make_session("s2", "p2")]);
app.sessions[1].messages.clear();
app.request_trash_zero_messages();
assert_eq!(app.confirm_action, Some(ConfirmAction::TrashZeroMessages));
assert!(app.status_message.unwrap().contains("1"));
}test_request_trash_zero_messages_none_found function · rust · L911-L918 (8 LOC)src/app.rs
fn test_request_trash_zero_messages_none_found() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.request_trash_zero_messages();
assert_eq!(app.confirm_action, None);
assert!(app.status_message.unwrap().contains("No empty sessions"));
}test_open_settings_copies_export_path_to_input function · rust · L921-L927 (7 LOC)src/app.rs
fn test_open_settings_copies_export_path_to_input() {
let mut app = App::with_sessions(vec![]);
app.config.export_path = "~/my-exports".to_string();
app.open_settings();
assert!(app.show_settings);
assert_eq!(app.settings_input, "~/my-exports");
}test_save_settings_updates_config_and_closes_modal function · rust · L930-L937 (8 LOC)src/app.rs
fn test_save_settings_updates_config_and_closes_modal() {
let mut app = App::with_sessions(vec![]);
app.open_settings();
app.settings_input = "/new/path".to_string();
app.save_settings();
assert!(!app.show_settings);
assert_eq!(app.config.export_path, "/new/path");
}test_cancel_settings_closes_modal_without_saving function · rust · L940-L948 (9 LOC)src/app.rs
fn test_cancel_settings_closes_modal_without_saving() {
let mut app = App::with_sessions(vec![]);
app.config.export_path = "~/original".to_string();
app.open_settings();
app.settings_input = "~/changed".to_string();
app.cancel_settings();
assert!(!app.show_settings);
assert_eq!(app.config.export_path, "~/original");
}test_settings_add_and_pop_char function · rust · L951-L960 (10 LOC)src/app.rs
fn test_settings_add_and_pop_char() {
let mut app = App::with_sessions(vec![]);
app.open_settings();
app.settings_add_char('/');
app.settings_add_char('f');
app.settings_add_char('o');
assert_eq!(app.settings_input, "~/claude-exports/fo");
app.settings_pop_char();
assert_eq!(app.settings_input, "~/claude-exports/f");
}test_focus_switches_back_to_list function · rust · L976-L981 (6 LOC)src/app.rs
fn test_focus_switches_back_to_list() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.focus_right();
app.focus_left();
assert_eq!(app.focus, FocusPanel::List);
}Repobility · MCP-ready · https://repobility.com
test_focus_right_stays_at_preview function · rust · L991-L996 (6 LOC)src/app.rs
fn test_focus_right_stays_at_preview() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.focus_right();
app.focus_right();
assert_eq!(app.focus, FocusPanel::Preview);
}test_page_down_list_moves_selection function · rust · L999-L1010 (12 LOC)src/app.rs
fn test_page_down_list_moves_selection() {
let mut app = App::with_sessions(vec![
make_session("s1", "p1"),
make_session("s2", "p2"),
make_session("s3", "p3"),
make_session("s4", "p4"),
make_session("s5", "p5"),
]);
app.focus = FocusPanel::List;
app.page_down(10); // page size larger than list
assert_eq!(app.selected_session_idx, 4); // clamped to last
}test_page_up_list_moves_selection function · rust · L1013-L1025 (13 LOC)src/app.rs
fn test_page_up_list_moves_selection() {
let mut app = App::with_sessions(vec![
make_session("s1", "p1"),
make_session("s2", "p2"),
make_session("s3", "p3"),
make_session("s4", "p4"),
make_session("s5", "p5"),
]);
app.focus = FocusPanel::List;
app.selected_session_idx = 4;
app.page_up(10);
assert_eq!(app.selected_session_idx, 0);
}test_page_down_preview_scrolls function · rust · L1028-L1033 (6 LOC)src/app.rs
fn test_page_down_preview_scrolls() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.focus = FocusPanel::Preview;
app.page_down(10);
assert_eq!(app.preview_scroll, 10);
}test_page_up_preview_scrolls function · rust · L1036-L1042 (7 LOC)src/app.rs
fn test_page_up_preview_scrolls() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.focus = FocusPanel::Preview;
app.preview_scroll = 15;
app.page_up(10);
assert_eq!(app.preview_scroll, 5);
}test_switch_to_selected_session_sets_resume_id function · rust · L1045-L1052 (8 LOC)src/app.rs
fn test_switch_to_selected_session_sets_resume_id() {
let session = make_session("test-id", "test-project");
let mut app = App::with_sessions(vec![session]);
app.switch_to_selected_session();
assert_eq!(app.resume_session_id, Some("test-id".to_string()));
}test_switch_to_selected_session_sets_resume_path function · rust · L1055-L1062 (8 LOC)src/app.rs
fn test_switch_to_selected_session_sets_resume_path() {
let session = make_session("test-id", "test-project");
let mut app = App::with_sessions(vec![session.clone()]);
app.switch_to_selected_session();
assert_eq!(app.resume_session_path, Some(session.project_path));
}test_get_resume_command_builds_correct_command function · rust · L1071-L1081 (11 LOC)src/app.rs
fn test_get_resume_command_builds_correct_command() {
let session = make_session("abc123", "project");
let mut app = App::with_sessions(vec![session]);
app.switch_to_selected_session();
assert_eq!(
app.get_resume_command(),
Some("claude --resume abc123".to_string())
);
}All rows above produced by Repobility · https://repobility.com
test_get_resume_session_path function · rust · L1084-L1091 (8 LOC)src/app.rs
fn test_get_resume_session_path() {
let session = make_session("test-id", "test-project");
let mut app = App::with_sessions(vec![session.clone()]);
app.switch_to_selected_session();
assert_eq!(app.get_resume_session_path(), Some(session.project_path));
}test_resume_command_persists function · rust · L1094-L1104 (11 LOC)src/app.rs
fn test_resume_command_persists() {
let session = make_session("persist-test", "p");
let mut app = App::with_sessions(vec![session]);
app.switch_to_selected_session();
let cmd1 = app.get_resume_command();
let cmd2 = app.get_resume_command();
assert_eq!(cmd1, cmd2);
assert_eq!(cmd1, Some("claude --resume persist-test".to_string()));
}test_toggle_sort_cycles_fields function · rust · L1107-L1116 (10 LOC)src/app.rs
fn test_toggle_sort_cycles_fields() {
let mut app = App::with_sessions(vec![]);
assert_eq!(app.sort_field, SortField::Date);
app.toggle_sort();
assert_eq!(app.sort_field, SortField::Project);
app.toggle_sort();
assert_eq!(app.sort_field, SortField::Messages);
app.toggle_sort();
assert_eq!(app.sort_field, SortField::Date);
}test_toggle_sort_resets_direction_to_descending function · rust · L1119-L1124 (6 LOC)src/app.rs
fn test_toggle_sort_resets_direction_to_descending() {
let mut app = App::with_sessions(vec![]);
app.sort_direction = SortDirection::Ascending;
app.toggle_sort();
assert_eq!(app.sort_direction, SortDirection::Descending);
}test_toggle_sort_direction function · rust · L1127-L1134 (8 LOC)src/app.rs
fn test_toggle_sort_direction() {
let mut app = App::with_sessions(vec![]);
assert_eq!(app.sort_direction, SortDirection::Descending);
app.toggle_sort_direction();
assert_eq!(app.sort_direction, SortDirection::Ascending);
app.toggle_sort_direction();
assert_eq!(app.sort_direction, SortDirection::Descending);
}test_toggle_help_opens_and_closes function · rust · L1137-L1144 (8 LOC)src/app.rs
fn test_toggle_help_opens_and_closes() {
let mut app = App::with_sessions(vec![]);
assert!(!app.show_help);
app.toggle_help();
assert!(app.show_help);
app.toggle_help();
assert!(!app.show_help);
}test_toggle_help_resets_scroll_on_close function · rust · L1147-L1153 (7 LOC)src/app.rs
fn test_toggle_help_resets_scroll_on_close() {
let mut app = App::with_sessions(vec![]);
app.toggle_help();
app.help_scroll = 42;
app.toggle_help();
assert_eq!(app.help_scroll, 0);
}test_help_scroll_up_and_down function · rust · L1156-L1164 (9 LOC)src/app.rs
fn test_help_scroll_up_and_down() {
let mut app = App::with_sessions(vec![]);
app.help_scroll_down(10);
assert_eq!(app.help_scroll, 10);
app.help_scroll_up(3);
assert_eq!(app.help_scroll, 7);
app.help_scroll_up(100);
assert_eq!(app.help_scroll, 0);
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
test_preview_scroll_up_and_down function · rust · L1167-L1175 (9 LOC)src/app.rs
fn test_preview_scroll_up_and_down() {
let mut app = App::with_sessions(vec![]);
app.preview_scroll_down(5);
assert_eq!(app.preview_scroll, 5);
app.preview_scroll_up(3);
assert_eq!(app.preview_scroll, 2);
app.preview_scroll_up(100);
assert_eq!(app.preview_scroll, 0);
}test_toggle_search_opens_and_closes function · rust · L1178-L1185 (8 LOC)src/app.rs
fn test_toggle_search_opens_and_closes() {
let mut app = App::with_sessions(vec![]);
assert!(!app.show_search);
app.toggle_search();
assert!(app.show_search);
app.toggle_search();
assert!(!app.show_search);
}test_toggle_search_clears_query_on_close function · rust · L1188-L1194 (7 LOC)src/app.rs
fn test_toggle_search_clears_query_on_close() {
let mut app = App::with_sessions(vec![]);
app.toggle_search();
app.search_query = "test".to_string();
app.toggle_search();
assert!(app.search_query.is_empty());
}test_add_search_char_resets_selection function · rust · L1197-L1204 (8 LOC)src/app.rs
fn test_add_search_char_resets_selection() {
let mut app =
App::with_sessions(vec![make_session("s1", "p1"), make_session("s2", "p2")]);
app.selected_session_idx = 1;
app.add_search_char('x');
assert_eq!(app.selected_session_idx, 0);
assert_eq!(app.search_query, "x");
}test_pop_search_char_resets_selection function · rust · L1207-L1214 (8 LOC)src/app.rs
fn test_pop_search_char_resets_selection() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.search_query = "abc".to_string();
app.selected_session_idx = 1;
app.pop_search_char();
assert_eq!(app.search_query, "ab");
assert_eq!(app.selected_session_idx, 0);
}test_cancel_confirmation function · rust · L1217-L1224 (8 LOC)src/app.rs
fn test_cancel_confirmation() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.request_delete_confirmation();
assert!(app.is_confirmation_pending());
app.cancel_confirmation();
assert!(!app.is_confirmation_pending());
assert!(app.status_message.unwrap().contains("cancelled"));
}test_confirm_execute_delete_permanently function · rust · L1229-L1237 (9 LOC)src/app.rs
fn test_confirm_execute_delete_permanently() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("trash-1", "p1")];
app.current_tab = Tab::Trash;
app.confirm_action = Some(ConfirmAction::DeletePermanently("trash-1".to_string()));
app.confirm_and_execute();
assert!(app.trash.is_empty());
assert!(app.confirm_action.is_none());
}test_confirm_execute_empty_trash function · rust · L1240-L1248 (9 LOC)src/app.rs
fn test_confirm_execute_empty_trash() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("t1", "p1"), make_session("t2", "p2")];
app.current_tab = Tab::Trash;
app.confirm_action = Some(ConfirmAction::EmptyTrash);
app.confirm_and_execute();
assert!(app.trash.is_empty());
assert!(app.confirm_action.is_none());
}Want this analysis on your repo? https://repobility.com/scan/
test_confirm_execute_trash_zero_messages function · rust · L1251-L1259 (9 LOC)src/app.rs
fn test_confirm_execute_trash_zero_messages() {
let mut app = App::with_sessions(vec![make_session("s1", "p1"), make_session("s2", "p2")]);
app.sessions[1].messages.clear();
app.confirm_action = Some(ConfirmAction::TrashZeroMessages);
app.confirm_and_execute();
assert_eq!(app.sessions.len(), 1);
assert_eq!(app.trash.len(), 1);
assert!(app.confirm_action.is_none());
}test_confirm_execute_delete_to_trash_is_noop function · rust · L1262-L1269 (8 LOC)src/app.rs
fn test_confirm_execute_delete_to_trash_is_noop() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.confirm_action = Some(ConfirmAction::DeleteToTrash("s1".to_string()));
app.confirm_and_execute();
// DeleteToTrash is handled in main.rs, so this is a no-op
assert_eq!(app.sessions.len(), 1);
assert!(app.confirm_action.is_some()); // not cleared by this path
}test_delete_permanently_adjusts_selection function · rust · L1272-L1281 (10 LOC)src/app.rs
fn test_delete_permanently_adjusts_selection() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("t1", "p1"), make_session("t2", "p2")];
app.current_tab = Tab::Trash;
app.selected_session_idx = 1;
app.confirm_action = Some(ConfirmAction::DeletePermanently("t2".to_string()));
app.delete_permanently();
assert_eq!(app.trash.len(), 1);
assert_eq!(app.selected_session_idx, 0);
}test_delete_permanently_wrong_action_early_return function · rust · L1284-L1291 (8 LOC)src/app.rs
fn test_delete_permanently_wrong_action_early_return() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("t1", "p1")];
app.confirm_action = Some(ConfirmAction::EmptyTrash);
app.delete_permanently();
// Should do nothing because action is not DeletePermanently
assert_eq!(app.trash.len(), 1);
}test_empty_trash_clears_all_and_resets function · rust · L1294-L1305 (12 LOC)src/app.rs
fn test_empty_trash_clears_all_and_resets() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("t1", "p1"), make_session("t2", "p2")];
app.current_tab = Tab::Trash;
app.selected_session_idx = 1;
app.confirm_action = Some(ConfirmAction::EmptyTrash);
app.empty_trash();
assert!(app.trash.is_empty());
assert_eq!(app.selected_session_idx, 0);
assert!(app.confirm_action.is_none());
assert!(app.status_message.unwrap().contains("2 sessions"));
}test_move_to_trash_noop_in_trash_tab function · rust · L1308-L1314 (7 LOC)src/app.rs
fn test_move_to_trash_noop_in_trash_tab() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.current_tab = Tab::Trash;
app.move_selected_to_trash();
assert_eq!(app.sessions.len(), 1);
assert!(app.trash.is_empty());
}test_request_empty_trash_noop_in_sessions_tab function · rust · L1317-L1322 (6 LOC)src/app.rs
fn test_request_empty_trash_noop_in_sessions_tab() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.trash = vec![make_session("t1", "p1")];
app.request_empty_trash();
assert!(app.confirm_action.is_none());
}test_request_empty_trash_when_already_empty function · rust · L1325-L1331 (7 LOC)src/app.rs
fn test_request_empty_trash_when_already_empty() {
let mut app = App::with_sessions(vec![]);
app.current_tab = Tab::Trash;
app.request_empty_trash();
assert!(app.confirm_action.is_none());
assert!(app.status_message.unwrap().contains("already empty"));
}Repobility · MCP-ready · https://repobility.com
test_request_delete_confirmation_in_trash_tab function · rust · L1334-L1344 (11 LOC)src/app.rs
fn test_request_delete_confirmation_in_trash_tab() {
let mut app = App::with_sessions(vec![]);
app.trash = vec![make_session("t1", "p1")];
app.current_tab = Tab::Trash;
app.request_delete_confirmation();
assert_eq!(
app.confirm_action,
Some(ConfirmAction::DeletePermanently("t1".to_string()))
);
assert!(app.status_message.unwrap().contains("PERMANENTLY"));
}test_request_trash_zero_messages_noop_in_trash_tab function · rust · L1347-L1352 (6 LOC)src/app.rs
fn test_request_trash_zero_messages_noop_in_trash_tab() {
let mut app = App::with_sessions(vec![]);
app.current_tab = Tab::Trash;
app.request_trash_zero_messages();
assert!(app.confirm_action.is_none());
}test_filtered_sessions_sorts_by_project function · rust · L1357-L1367 (11 LOC)src/app.rs
fn test_filtered_sessions_sorts_by_project() {
let mut app = App::with_sessions(vec![
make_session("s1", "zulu"),
make_session("s2", "alpha"),
]);
app.sort_field = SortField::Project;
app.sort_direction = SortDirection::Ascending;
let filtered = app.filtered_sessions();
assert_eq!(filtered[0].project_name, "alpha");
assert_eq!(filtered[1].project_name, "zulu");
}test_filtered_sessions_sorts_by_messages function · rust · L1370-L1383 (14 LOC)src/app.rs
fn test_filtered_sessions_sorts_by_messages() {
let mut s1 = make_session("s1", "p1");
s1.messages.push(Message {
role: "user".to_string(),
content: "extra".to_string(),
});
let s2 = make_session("s2", "p2");
let mut app = App::with_sessions(vec![s1, s2]);
app.sort_field = SortField::Messages;
app.sort_direction = SortDirection::Ascending;
let filtered = app.filtered_sessions();
assert_eq!(filtered[0].messages.len(), 1); // s2 has 1
assert_eq!(filtered[1].messages.len(), 2); // s1 has 2
}test_filtered_sessions_descending_reverses function · rust · L1386-L1396 (11 LOC)src/app.rs
fn test_filtered_sessions_descending_reverses() {
let mut app = App::with_sessions(vec![
make_session("s1", "alpha"),
make_session("s2", "zulu"),
]);
app.sort_field = SortField::Project;
app.sort_direction = SortDirection::Descending;
let filtered = app.filtered_sessions();
assert_eq!(filtered[0].project_name, "zulu");
assert_eq!(filtered[1].project_name, "alpha");
}test_confirm_execute_with_no_action function · rust · L1399-L1404 (6 LOC)src/app.rs
fn test_confirm_execute_with_no_action() {
let mut app = App::with_sessions(vec![make_session("s1", "p1")]);
app.confirm_action = None;
app.confirm_and_execute(); // should not panic
assert_eq!(app.sessions.len(), 1);
}delete_session function · rust · L6-L11 (6 LOC)src/commands.rs
pub fn delete_session(_session: &Session) -> Result<()> {
let trash_dir = dirs::home_dir().expect("home dir").join(".claude/trash");
fs::create_dir_all(&trash_dir)?;
Ok(())
}export_session function · rust · L12-L48 (37 LOC)src/commands.rs
pub fn export_session(session: &Session, export_dir: &Path) -> Result<String> {
fs::create_dir_all(export_dir)?;
let filename = format!(
"{}-{}.md",
session.project_name,
&session.id[..8.min(session.id.len())]
);
let path = export_dir.join(filename);
let mut file = fs::File::create(&path)?;
writeln!(file, "# Session: {}", session.display_name())?;
writeln!(file, "")?;
writeln!(file, "- **Project:** {}", session.project_name)?;
writeln!(file, "- **Session ID:** {}", session.id)?;
writeln!(file, "- **Created:** {}", session.created_at)?;
writeln!(file, "- **Updated:** {}", session.updated_at)?;
writeln!(file, "")?;
writeln!(file, "---")?;
writeln!(file, "")?;
for msg in &session.messages {
let prefix = if msg.role == "user" {
"## You"
} else {
"## Assistant"
};
writeln!(file, "{}", prefix)?;
writeln!(file, "")?;
writeln!(file, "{All rows above produced by Repobility · https://repobility.com
make_test_session function · rust · L54-L75 (22 LOC)src/commands.rs
fn make_test_session() -> Session {
Session {
id: "abc12345-test".to_string(),
project_path: "/test/path".to_string(),
project_name: "test-project".to_string(),
created_at: "2026-01-01T00:00:00".to_string(),
updated_at: "2026-01-02T00:00:00".to_string(),
size: 1234,
total_entries: 2,
messages: vec![
Message {
role: "user".to_string(),
content: "Hello".to_string(),
},
Message {
role: "assistant".to_string(),
content: "Hi there".to_string(),
},
],
}
}test_export_session_creates_markdown function · rust · L85-L101 (17 LOC)src/commands.rs
fn test_export_session_creates_markdown() {
use tempfile::TempDir;
let tmp = TempDir::new().unwrap();
let session = make_test_session();
let result = export_session(&session, tmp.path());
assert!(result.is_ok());
let path = result.unwrap();
assert!(path.contains("test-project-abc12345"));
assert!(path.ends_with(".md"));
let content = fs::read_to_string(&path).unwrap();
assert!(content.contains("# Session:"));
assert!(content.contains("Hello"));
assert!(content.contains("Hi there"));
assert!(content.contains("## You"));
assert!(content.contains("## Assistant"));
}load function · rust · L19-L29 (11 LOC)src/config.rs
pub fn load() -> Self {
let path = Self::config_path();
if !path.exists() {
return Self::default();
}
let content = match std::fs::read_to_string(&path) {
Ok(c) => c,
Err(_) => return Self::default(),
};
serde_json::from_str(&content).unwrap_or_default()
}