Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust

test(cli): compare the context test's paths the way Windows reports them

Corey Chiu12969633ee67
diff --git a/crates/wake-core/tests/cli.rs b/crates/wake-core/tests/cli.rs
index 74c9aa3..98225ce 100644
--- a/crates/wake-core/tests/cli.rs
+++ b/crates/wake-core/tests/cli.rs
@@ -766,7 +766,7 @@ fn refresh_refuses_when_only_remote_memories_would_be_lost() {
#[test]
fn context_shows_where_each_agent_left_off_or_nothing() {
let tmp = tempfile::tempdir().unwrap();
- let home = std::fs::canonicalize(tmp.path()).unwrap();
+ let home = common::real_dir(tmp.path());
let project = home.join("app");
let fresh = home.join("fresh");
std::fs::create_dir_all(project.join("src")).unwrap();
diff --git a/crates/wake-core/tests/common/mod.rs b/crates/wake-core/tests/common/mod.rs
index 6edd394..e8f1bb2 100644
--- a/crates/wake-core/tests/common/mod.rs
+++ b/crates/wake-core/tests/common/mod.rs
@@ -36,6 +36,17 @@ pub fn meta(key: &str, title: &str) -> SessionMeta {
}
}
+/// 目录的真实路径,与子进程看到的工作目录同一种写法:macOS 的临时目录在符号链接后面
+/// (/var → /private/var),子进程的 cwd 是解开后的;Windows 的 canonicalize 会加 `\\?\`
+/// 前缀,子进程的 cwd 没有它——直接拿 canonicalize 的结果去比,Windows 上一条都对不上
+pub fn real_dir(path: &Path) -> PathBuf {
+ let real = fs::canonicalize(path).unwrap();
+ match real.to_str().and_then(|s| s.strip_prefix(r"\\?\")) {
+ Some(rest) => PathBuf::from(rest),
+ None => real,
+ }
+}
+
/// 一个索引单元(主线、时间戳随 seq 递增);IndexUnit 同样没有 Default
pub fn unit(seq: i64, role: Role, text: &str) -> IndexUnit {
IndexUnit {