mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Add cargo --no-verify test when checking that src dir was not modified while publishing
This commit is contained in:
parent
8896fddef8
commit
ba48ff4273
@ -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),
|
||||
);
|
||||
}
|
||||
|
@ -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),
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user