Add cargo --no-verify test when checking that src dir was not modified while publishing

This commit is contained in:
Gabriel Féron 2018-05-28 13:59:35 +02:00
parent 8896fddef8
commit ba48ff4273
2 changed files with 35 additions and 33 deletions

View File

@ -1416,3 +1416,38 @@ fn lock_file_and_workspace() {
fname.ends_with("Cargo.lock")
}));
}
#[test]
fn do_not_package_if_src_was_modified() {
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
"#)
.file("src/main.rs", r#"
fn main() { println!("hello"); }
"#)
.file("build.rs", r#"
use std::fs::File;
use std::io::Write;
fn main() {
let mut file = File::create("src/generated.txt").expect("failed to create file");
file.write_all(b"Hello, world of generated files.").expect("failed to write");
}
"#)
.build();
assert_that(
p.cargo("package"),
execs().with_status(101),
);
assert_that(
p.cargo("package")
.arg("--no-verify"),
execs().with_status(0),
);
}

View File

@ -872,36 +872,3 @@ fn block_publish_no_registry() {
),
);
}
#[test]
fn do_not_publish_if_src_was_modified() {
publish::setup();
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
"#)
.file("src/main.rs", r#"
fn main() { println!("hello"); }
"#)
.file("build.rs", r#"
use std::fs::File;
use std::io::Write;
fn main() {
let mut file = File::create("src/generated.txt").expect("failed to create file");
file.write_all(b"Hello, world of generated files.").expect("failed to write");
}
"#)
.build();
assert_that(
p.cargo("publish")
.arg("--index")
.arg(publish::registry().to_string()),
execs().with_status(101),
);
}