test: make the Windows Rust job pass again (#7516)

git_workflows: the 700 overlong paths of the two command-line batching tests exceeded Windows' 260-char MAX_PATH (Git for Windows enforces it without core.longpaths), so git add failed; on Windows they use shorter names that still overflow its 32,000-char command line. xcode_index: the test formatted a path into buildServer.json, and a Windows path's backslashes made the JSON invalid; it is built with serde_json now.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-02 18:46:03 +08:00
1 джерело b630dfad55
коміт 471bce2bb1
2 files changed
+13 -5

No files matched your search

+2 -1
Переглянути файл
@@ -147,8 +147,9 @@ mod tests {
let root = tmp.path();
assert_eq!(xcode_build_root(root), None);
let dd = root.join("DerivedData/App-abc");
// Built as JSON, not by formatting: a Windows path's backslashes need escaping.
let config =
|kind: &str| format!(r#"{{"name":"xcode build server","kind":"{kind}","build_root":"{}"}}"#, dd.display());
|kind: &str| serde_json::json!({"name": "xcode build server", "kind": kind, "build_root": dd}).to_string();
std::fs::write(root.join("buildServer.json"), config("manual")).unwrap();
assert_eq!(xcode_build_root(root), None, "a hand-written .compile config");
std::fs::write(root.join("buildServer.json"), r#"{"name":"sourcekit-xcode-bsp","argv":["x"]}"#).unwrap();
+11 -4
Переглянути файл
@@ -3710,11 +3710,18 @@ fn blocked_restore_keeps_the_deletion_record_for_the_next_attempt() {
assert!(!fx.exists(".git/openidea-saved-deletions"));
}
/// A folder and file name whose 700 paths overflow one command line (32,000 chars on Windows,
/// 120,000 elsewhere), while each absolute path stays within Windows' 260-char `MAX_PATH`,
/// which Git for Windows enforces without `core.longpaths`.
fn overlong_names() -> (String, String) {
if cfg!(windows) { ("f".repeat(40), "n".repeat(60)) } else { ("f".repeat(100), "n".repeat(110)) }
}
#[test]
fn pull_keeps_more_deleted_new_files_than_one_command_line_holds_deleted() {
let (fx, bare) = Fixture::with_origin();
let folder = "f".repeat(100);
let paths: Vec<String> = (0..700).map(|i| format!("{folder}/{i:04}-{}.txt", "n".repeat(110))).collect();
let (folder, name) = overlong_names();
let paths: Vec<String> = (0..700).map(|i| format!("{folder}/{i:04}-{name}.txt")).collect();
for path in &paths {
fx.write(path, "new\n");
}
@@ -3763,8 +3770,8 @@ fn deleting_more_added_files_than_one_command_line_holds_drops_them_all() {
let fx = Fixture::new();
fx.write("base.txt", "base\n");
fx.commit_all("base");
let folder = "f".repeat(100);
let paths: Vec<PathBuf> = (0..700).map(|i| fx.path(&format!("{folder}/{i:04}-{}.txt", "n".repeat(110)))).collect();
let (folder, name) = overlong_names();
let paths: Vec<PathBuf> = (0..700).map(|i| fx.path(&format!("{folder}/{i:04}-{name}.txt"))).collect();
for path in &paths {
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
std::fs::write(path, "new\n").unwrap();