aboutsummaryrefslogtreecommitdiff
path: root/src/terminal
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal')
-rw-r--r--src/terminal/runtime.rs1
-rw-r--r--src/terminal/state.rs30
2 files changed, 23 insertions, 8 deletions
diff --git a/src/terminal/runtime.rs b/src/terminal/runtime.rs
index 6d761b11..c74301ad 100644
--- a/src/terminal/runtime.rs
+++ b/src/terminal/runtime.rs
@@ -201,6 +201,7 @@ impl TerminalRuntime {
self.0.resize(rows, cols, cell_width_px, cell_height_px);
}
+ #[cfg(unix)]
pub fn nudge_child_redraw_after_handoff(&self) {
self.0.nudge_child_redraw_after_handoff();
}
diff --git a/src/terminal/state.rs b/src/terminal/state.rs
index ec113b14..bb2642d9 100644
--- a/src/terminal/state.rs
+++ b/src/terminal/state.rs
@@ -838,6 +838,14 @@ mod tests {
TerminalState::new(TerminalId::alloc(), "/tmp".into())
}
+ fn test_session_path(name: &str) -> String {
+ std::env::current_dir()
+ .unwrap()
+ .join(name)
+ .display()
+ .to_string()
+ }
+
#[test]
fn claude_working_is_sticky_for_short_gap() {
let now = std::time::Instant::now();
@@ -1805,6 +1813,7 @@ mod tests {
#[test]
fn accepted_hook_report_stores_session_ref() {
let mut terminal = test_terminal();
+ let session_path = test_session_path("pi.jsonl");
let mutation = terminal
.set_hook_authority_with_session_ref(
"herdr:pi".into(),
@@ -1812,7 +1821,7 @@ mod tests {
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/pi.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
)
.expect("accepted report");
@@ -1826,7 +1835,7 @@ mod tests {
.map(|session_ref| (&session_ref.kind, session_ref.value.as_str())),
Some((
&crate::agent_resume::AgentSessionRefKind::Path,
- "/tmp/pi.jsonl"
+ session_path.as_str()
))
);
}
@@ -1834,13 +1843,15 @@ mod tests {
#[test]
fn stale_hook_report_cannot_overwrite_session_ref() {
let mut terminal = test_terminal();
+ let session_path = test_session_path("pi.jsonl");
+ let new_session_path = test_session_path("new.jsonl");
terminal.set_hook_authority_with_session_ref(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/pi.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
);
@@ -1850,7 +1861,7 @@ mod tests {
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/new.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(new_session_path),
Some(19),
);
@@ -1861,20 +1872,21 @@ mod tests {
.as_ref()
.and_then(|authority| authority.session_ref.as_ref())
.map(|session_ref| session_ref.value.as_str()),
- Some("/tmp/pi.jsonl")
+ Some(session_path.as_str())
);
}
#[test]
fn accepted_hook_report_without_session_ref_clears_previous_ref() {
let mut terminal = test_terminal();
+ let session_path = test_session_path("pi.jsonl");
terminal.set_hook_authority_with_session_ref(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/pi.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);
@@ -1927,13 +1939,14 @@ mod tests {
#[test]
fn clearing_hook_authority_clears_session_ref() {
let mut terminal = test_terminal();
+ let session_path = test_session_path("pi.jsonl");
terminal.set_hook_authority_with_session_ref(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/pi.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);
@@ -1948,13 +1961,14 @@ mod tests {
#[test]
fn release_agent_clears_session_ref() {
let mut terminal = test_terminal();
+ let session_path = test_session_path("pi.jsonl");
terminal.set_hook_authority_with_session_ref(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- crate::agent_resume::AgentSessionRef::path("/tmp/pi.jsonl"),
+ crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);