mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-10-03 16:01:59 +00:00
test(git): compare repo roots in one spelling so Windows passes (#1013)
canonicalize answers \\?\C:\... on Windows while git prints C:/...; the production path already folds the first into the local spelling in probe_repo, only the test compared them raw.
This commit is contained in:
@@ -92,7 +92,7 @@ fn branch_of(head: &str) -> Option<String> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::core::git::test_support::PINS;
|
||||
use crate::core::git::test_support::{PINS, one_spelling};
|
||||
|
||||
fn git(cwd: &Path, args: &[&str]) -> Option<String> {
|
||||
let mut full = PINS.to_vec();
|
||||
@@ -155,9 +155,14 @@ mod tests {
|
||||
assert_eq!(got.root, canon(root), "root of {}", cwd.display());
|
||||
assert_eq!(got.home, canon(home), "home of {}", cwd.display());
|
||||
assert_eq!(got.branch.as_deref(), Some(branch));
|
||||
// In one spelling: `canonicalize` answers `\\?\C:\…` on Windows and
|
||||
// git `C:/…`. `probe_repo` folds the first into the local spelling
|
||||
// before anything keys on it.
|
||||
assert_eq!(
|
||||
got.root,
|
||||
PathBuf::from(git(cwd, &["rev-parse", "--show-toplevel"]).unwrap()),
|
||||
one_spelling(&got.root),
|
||||
one_spelling(Path::new(
|
||||
&git(cwd, &["rev-parse", "--show-toplevel"]).unwrap()
|
||||
)),
|
||||
"and git names the same root"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user