Skip to content

Commit c335817

Browse files
committed
Tidy goto invalid number error
1 parent 7954d02 commit c335817

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/cortex-tui/src/commands/executor/navigation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl CommandExecutor {
2626
if n.parse::<usize>().is_ok() {
2727
CommandResult::SetValue("goto".to_string(), n.to_string())
2828
} else {
29-
CommandResult::Error(format!("Invalid message number: {}", n))
29+
CommandResult::Error(format!("Invalid message number \"{}\"", n))
3030
}
3131
}
3232
None => CommandResult::OpenModal(ModalType::Form("goto".to_string())),

src/cortex-tui/src/commands/executor/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,11 @@ fn test_goto_validation() {
389389
));
390390

391391
let result = executor.execute_str("/goto abc");
392-
assert!(matches!(result, CommandResult::Error(_)));
392+
assert!(matches!(
393+
result,
394+
CommandResult::Error(ref msg)
395+
if msg == "Invalid message number \"abc\"" && !msg.contains("number:")
396+
));
393397

394398
let result = executor.execute_str("/goto");
395399
assert!(matches!(

0 commit comments

Comments
 (0)