history : reexecution (issues #27 #28) - expansion !! !N !prefix ^old^new dans le REPL + am history --rerun N avec confirmation (shell ou commande am)

This commit is contained in:
2026-08-17 08:05:58 -04:00
parent 4ef89cde72
commit 81c69db17b
6 changed files with 126 additions and 1 deletions
+18 -1
View File
@@ -89,12 +89,29 @@ fn command_runs_and_migrates() {
let txt = app.paths.state_file.with_file_name("history.txt");
std::fs::write(&txt, "install jcode
").unwrap();
let code = history_cmd::run(&app, None, None, None, false, None, 100).unwrap();
let code = history_cmd::run(&app, None, None, None, false, None, 100, None).unwrap();
assert_eq!(code, 0);
// Migration created the structured file.
assert!(history::dir(&app).join("migrated.jsonl").exists());
}
#[test]
fn rerun_executes_shell_entry_with_yes() {
let app = common::test_app("rerun", &["history", "--rerun", "1", "--yes"]);
history::record(
&app,
"s1",
&HistoryEntry::now("echo rerun-ok").with_kind("shell".to_string()),
)
.unwrap();
let code = history_cmd::run(&app, None, None, None, false, None, 100, Some(1)).unwrap();
assert_eq!(code, 0);
// Numéro hors plage : erreur claire.
assert!(history_cmd::run(&app, None, None, None, false, None, 100, Some(9)).is_err());
// Zéro : erreur claire.
assert!(history_cmd::run(&app, None, None, None, false, None, 100, Some(0)).is_err());
}
#[test]
fn fixture_session_file_parses() {
// Guard for session_of_file used by the display layer.