Merge PR #270 (fa080f48) into the 2026-09-24 integration wave

This commit is contained in:
Edward Langley
2026-09-24 02:44:29 -07:00
4 changed files with 86 additions and 23 deletions
+33 -22
View File
@@ -2427,7 +2427,7 @@ mod tests {
..view.clone()
};
let before = quiet(&state.view);
commands.iter().for_each(|c| state.fold(c));
state.fold_outgoing(&commands);
let sent = commands.iter().any(|c| matches!(c, Command::Model { .. }));
let said = commands.iter().any(|c| matches!(c, Command::SetStatus(_)));
match (sent || quiet(&state.view) != before, said) {
@@ -2487,7 +2487,7 @@ mod tests {
let (last, prefix) = sequence.split_last().expect("a sequence has a key");
for key in prefix {
if let KeyOutcome::Local(commands) = resolve(&state, *key) {
commands.iter().for_each(|c| state.fold(c));
state.fold_outgoing(&commands);
}
}
let outcome = resolve(&state, *last);
@@ -2650,7 +2650,7 @@ mod tests {
let view = state.view.active_view.clone();
for key in &sequence {
if let KeyOutcome::Local(commands) = resolve(&state, *key) {
commands.iter().for_each(|c| state.fold(c));
state.fold_outgoing(&commands);
}
}
let landed = state.view.cursor().selected;
@@ -2820,7 +2820,7 @@ mod tests {
let (key, prefix) = sequence.split_last().expect("a key");
for armed in prefix {
if let KeyOutcome::Local(commands) = resolve(&state, *armed) {
commands.iter().for_each(|c| state.fold(c));
state.fold_outgoing(&commands);
}
}
let key = *key;
@@ -3600,9 +3600,8 @@ mod tests {
commands.contains(&Command::SetOpenedEditor(Some(OpenedEditor::awaiting()))),
"after a write the reopened editor awaits the host's seed: {commands:?}"
);
for command in &commands {
client.fold(command);
}
client.fold_outgoing(&commands);
client.accepted();
assert_eq!(
client.view.buffers.get("edit").map(String::as_str),
Some("900"),
@@ -3643,9 +3642,7 @@ mod tests {
let KeyOutcome::Local(commands) = resolve(client, ev(code)) else {
panic!("{code:?} must resolve here");
};
for command in &commands {
client.fold(command);
}
client.fold_outgoing(&commands);
commands
}
@@ -3737,6 +3734,27 @@ mod tests {
);
}
/// A frame this client composed goes through `fold_outgoing`, so a commit
/// waits for the host (improvise-aopa). See `context/test-evidence/clients.md`.
#[test]
fn a_folded_browser_commit_waits_for_the_host() {
let mut client = client_on_row_one("7");
press_folded(&mut client, KeyCode::Char('i'));
press_folded(&mut client, KeyCode::Char('9'));
assert!(
client.in_flight.is_empty(),
"no Model yet, so nothing waits"
);
let commit = press_folded(&mut client, KeyCode::Enter);
assert!(
commit.iter().any(|c| matches!(c, Command::Model { .. })),
"a typed commit writes: {commit:?}"
);
assert_eq!(client.in_flight.len(), 1, "the commit is unanswered");
assert!(client.in_flight[0].awaited);
assert_eq!(client.in_flight[0].cmds, commit);
}
/// improvise-465t: the editor an advance reopens starts untouched, even
/// after a typed commit. See `context/test-evidence/clients.md`.
#[test]
@@ -3750,6 +3768,7 @@ mod tests {
"the first editor was never touched, so this proves nothing"
);
press_folded(&mut client, KeyCode::Enter);
client.accepted();
assert_eq!(
client.view.cursor().selected,
(2, 0),
@@ -3848,9 +3867,7 @@ mod tests {
&["editing".into()],
)
.expect("enter-mode editing composes here");
for command in &entered {
client.fold(command);
}
client.fold_outgoing(&entered);
assert!(
client.view.mode.is_editing(),
"enter-mode did not open an editor"
@@ -3966,9 +3983,7 @@ mod tests {
let KeyOutcome::Local(typed) = resolve(&client, ev(KeyCode::Char('5'))) else {
panic!("a character in Editing is append-char");
};
for command in &typed {
client.fold(command);
}
client.fold_outgoing(&typed);
assert!(
matches!(
committed(&client),
@@ -4064,9 +4079,7 @@ mod tests {
let KeyOutcome::Local(commands) = resolve(state, prefix) else {
panic!("{prefix:?} is a prefix; arming it must resolve locally");
};
for command in &commands {
state.fold(command);
}
state.fold_outgoing(&commands);
assert_eq!(
state.view.transient_prefix,
Some((prefix.code, prefix.modifiers)),
@@ -4110,9 +4123,7 @@ mod tests {
"the cell under the cursor reads 1200: {yank:?}"
);
for command in &yank {
state.fold(command);
}
state.fold_outgoing(&yank);
assert_eq!(
state.view.transient_prefix, None,
"and the y prefix is spent"
+3
View File
@@ -40,6 +40,9 @@ wasm-bindgen = "0.2"
[dev-dependencies]
improvise-command = { path = "../improvise-command" }
improvise-core = { path = "../improvise-core" }
# The tests build `FormulaEntry` from `&str`, which only `test-support` provides.
# Asked for here, or `-p improvise-wasm-client` alone does not compile (a61f).
improvise-protocol = { path = "../improvise-protocol", features = ["test-support"] }
improvise-ws-server = { path = "../improvise-ws-server" }
# The `wasm-opt` wasm-pack downloads predates bulk-memory being enabled by