]> git.proxmox.com Git - cargo.git/commitdiff
enable the broken_symlink test on Windows
authorThom Wiggers <thom@thomwiggers.nl>
Thu, 11 Apr 2019 11:28:45 +0000 (13:28 +0200)
committerThom Wiggers <thom@thomwiggers.nl>
Tue, 30 Jul 2019 07:31:35 +0000 (09:31 +0200)
tests/testsuite/package.rs
tests/testsuite/support/mod.rs

index d895dca7812a06fc77459132fe56f008ef3b01fa..19bcbdbdee750601ec24391196688011fe92c7fd 100644 (file)
@@ -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)
index f64ac8dda712bb919572f6a9f389a5b6963ed527..cf1c3a0ec0e56990509b441dd9c8ac7bbaada9de 100644 (file)
@@ -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<T: AsRef<Path>>(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<T: AsRef<Path>>(mut self, dst: T, src: T) -> Self {
         self.symlinks.push(SymlinkBuilder::new_dir(
                 self.root.root().join(dst),