Fix ACP replay test on Windows
Co-Authored-By: siGit Code <noreply@sigit.si>
Seto Elkahfi committed
Sep 9, 2026 at 12:46 UTC
46c2d31e7fc8335871190f59253aa1ff9f091e89
1 file changed
+7
-4
src/main.rs
+7
-4
@@ -4040,6 +4040,9 @@ mod tests {
4040
4041
#[test]
4042
fn history_replay_redraws_the_conversation_for_the_client() {
4043
+ let changelog_path = std::env::current_dir().unwrap().join("CHANGELOG.md");
4044
+ let changelog_path_text = changelog_path.to_string_lossy().into_owned();
4045
+ let arguments = serde_json::json!({ "path": changelog_path_text }).to_string();
4046
let history = vec![
4047
serde_json::json!({ "role": "system", "content": "project context" }),
4048
serde_json::json!({ "role": "user", "content": "read the changelog" }),
@@ -4048,7 +4051,7 @@ mod tests {
4051
"content": "<think>which file?</think>Reading it now.",
4052
"tool_calls": [{
4053
"id": "call_1", "type": "function",
4051
- "function": { "name": "read_file", "arguments": "{\"path\":\"/tmp/CHANGELOG.md\"}" },
4054
+ "function": { "name": "read_file", "arguments": arguments },
4055
}],
4056
}),
4057
serde_json::json!({ "role": "tool", "tool_call_id": "call_1", "content": "# Changelog" }),
@@ -4077,13 +4080,13 @@ mod tests {
4080
}
4081
match &updates[2] {
4082
SessionUpdate::ToolCall(call) => {
4080
- assert_eq!(call.title, "read_file · /tmp/CHANGELOG.md");
4083
+ assert_eq!(call.title, format!("read_file · {changelog_path_text}"));
4084
assert_eq!(call.kind, ToolKind::Read);
4085
// Nothing is still running in a saved session.
4086
assert_eq!(call.status, ToolCallStatus::Completed);
4087
assert_eq!(
4088
call.raw_input,
4086
- Some(serde_json::json!({"path": "/tmp/CHANGELOG.md"}))
4089
+ Some(serde_json::json!({"path": changelog_path_text}))
4090
);
4091
// The result is folded into its call rather than replayed loose.
4092
assert_eq!(
@@ -4094,7 +4097,7 @@ mod tests {
4097
// output shows up as displayable content, not just raw_output.
4098
assert!(format!("{:?}", call.content).contains("# Changelog"));
4099
assert_eq!(call.locations.len(), 1);
4097
- assert_eq!(call.locations[0].path, PathBuf::from("/tmp/CHANGELOG.md"));
4100
+ assert_eq!(call.locations[0].path, changelog_path);
4101
}
4102
other => panic!("expected the tool call, got {other:?}"),
4103
}