mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-11-06 16:15:41 +00:00
test(editor): resolve temp dirs the way the editor does
On the Windows runner the temp dir is an 8.3 short name (RUNNER~1), which the editor's load expands through Host::canonicalize. The split tests now resolve their fixtures through that same call instead of guessing per platform.
This commit is contained in:
@@ -3757,16 +3757,14 @@ impl Tty7App {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// A temp dir as the editor will see paths under it: resolved through
|
||||
/// symlinks where the OS puts one in the way (`/var` is `/private/var` on
|
||||
/// macOS). Not on Windows, where `canonicalize` answers in the `\\?\` form
|
||||
/// no path the editor holds is ever in.
|
||||
/// A temp dir as the editor will see paths under it: through the local
|
||||
/// host's `canonicalize`, the call `load_file` makes. That resolves
|
||||
/// macOS's `/var` → `/private/var` and Windows' 8.3 short names
|
||||
/// (`RUNNER~1`), and never answers in Windows' `\\?\` form.
|
||||
pub(crate) fn test_real_dir(dir: &Path) -> PathBuf {
|
||||
if cfg!(windows) {
|
||||
dir.to_path_buf()
|
||||
} else {
|
||||
dir.canonicalize().unwrap()
|
||||
}
|
||||
tty7_core::host::local::LocalHost::new()
|
||||
.canonicalize(dir)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// Handing a file the editor cannot read to the desktop is how a click
|
||||
|
||||
Reference in New Issue
Block a user