mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
enable the broken_symlink test on Windows
This commit is contained in:
parent
50a24ff29b
commit
32130f8e58
@ -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)
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user