Skip to content

Commit 32130f8

Browse files
committed
enable the broken_symlink test on Windows
1 parent 50a24ff commit 32130f8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tests/testsuite/package.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ fn package_symlink_to_submodule() {
509509
#[cfg(unix)]
510510
use std::os::unix::fs::symlink as symlink;
511511
#[cfg(windows)]
512-
use std::os::unix::fs::symlink_dir as symlink;
512+
use std::os::windows::fs::symlink_dir as symlink;
513513

514514
let project = git::new("foo", |project| {
515515
project
@@ -697,9 +697,11 @@ See [..]
697697
}
698698

699699
#[cargo_test]
700-
#[cfg(unix)]
701700
fn broken_symlink() {
702-
use std::os::unix::fs;
701+
#[cfg(unix)]
702+
use std::os::unix::fs::symlink as symlink;
703+
#[cfg(windows)]
704+
use std::os::windows::fs::symlink_dir as symlink;
703705

704706
let p = project()
705707
.file(
@@ -718,7 +720,7 @@ fn broken_symlink() {
718720
)
719721
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
720722
.build();
721-
t!(fs::symlink("nowhere", &p.root().join("src/foo.rs")));
723+
t!(symlink("nowhere", &p.root().join("src/foo.rs")));
722724

723725
p.cargo("package -v")
724726
.with_status(101)

tests/testsuite/support/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl SymlinkBuilder {
200200
fn mk(&self) {
201201
self.dirname().mkdir_p();
202202
if self.src_is_dir {
203-
t!(os::window::fs::symlink_dir(&self.dst, &self.src));
203+
t!(os::windows::fs::symlink_dir(&self.dst, &self.src));
204204
} else {
205205
t!(os::windows::fs::symlink_file(&self.dst, &self.src));
206206
}
@@ -261,7 +261,7 @@ impl ProjectBuilder {
261261
.push(FileBuilder::new(self.root.root().join(path), body));
262262
}
263263

264-
/// Adds a symlink to the project.
264+
/// Adds a symlink to a file to the project.
265265
pub fn symlink<T: AsRef<Path>>(mut self, dst: T, src: T) -> Self {
266266
self.symlinks.push(SymlinkBuilder::new(
267267
self.root.root().join(dst),
@@ -270,6 +270,7 @@ impl ProjectBuilder {
270270
self
271271
}
272272

273+
/// Create a symlink to a directory
273274
pub fn symlink_dir<T: AsRef<Path>>(mut self, dst: T, src: T) -> Self {
274275
self.symlinks.push(SymlinkBuilder::new_dir(
275276
self.root.root().join(dst),

0 commit comments

Comments
 (0)