From 32130f8e58c5bb84bd5ad1570b40644225c3feb5 Mon Sep 17 00:00:00 2001 From: Thom Wiggers Date: Thu, 11 Apr 2019 13:28:45 +0200 Subject: [PATCH] enable the broken_symlink test on Windows --- tests/testsuite/package.rs | 10 ++++++---- tests/testsuite/support/mod.rs | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index d895dca78..19bcbdbde 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -509,7 +509,7 @@ fn package_symlink_to_submodule() { #[cfg(unix)] use std::os::unix::fs::symlink as symlink; #[cfg(windows)] - use std::os::unix::fs::symlink_dir as symlink; + use std::os::windows::fs::symlink_dir as symlink; let project = git::new("foo", |project| { project @@ -697,9 +697,11 @@ See [..] } #[cargo_test] -#[cfg(unix)] fn broken_symlink() { - use std::os::unix::fs; + #[cfg(unix)] + use std::os::unix::fs::symlink as symlink; + #[cfg(windows)] + use std::os::windows::fs::symlink_dir as symlink; let p = project() .file( @@ -718,7 +720,7 @@ fn broken_symlink() { ) .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - t!(fs::symlink("nowhere", &p.root().join("src/foo.rs"))); + t!(symlink("nowhere", &p.root().join("src/foo.rs"))); p.cargo("package -v") .with_status(101) diff --git a/tests/testsuite/support/mod.rs b/tests/testsuite/support/mod.rs index f64ac8dda..cf1c3a0ec 100644 --- a/tests/testsuite/support/mod.rs +++ b/tests/testsuite/support/mod.rs @@ -200,7 +200,7 @@ impl SymlinkBuilder { fn mk(&self) { self.dirname().mkdir_p(); if self.src_is_dir { - t!(os::window::fs::symlink_dir(&self.dst, &self.src)); + t!(os::windows::fs::symlink_dir(&self.dst, &self.src)); } else { t!(os::windows::fs::symlink_file(&self.dst, &self.src)); } @@ -261,7 +261,7 @@ impl ProjectBuilder { .push(FileBuilder::new(self.root.root().join(path), body)); } - /// Adds a symlink to the project. + /// Adds a symlink to a file to the project. pub fn symlink>(mut self, dst: T, src: T) -> Self { self.symlinks.push(SymlinkBuilder::new( self.root.root().join(dst), @@ -270,6 +270,7 @@ impl ProjectBuilder { self } + /// Create a symlink to a directory pub fn symlink_dir>(mut self, dst: T, src: T) -> Self { self.symlinks.push(SymlinkBuilder::new_dir( self.root.root().join(dst),