add a test

This commit is contained in:
Eh2406 2018-01-31 16:12:19 -05:00
parent b83ef97efb
commit ba05437554

View file

@ -74,6 +74,31 @@ fn adding_and_removing_packages() {
assert_eq!(lock1, lock4);
}
#[test]
fn no_index_update() {
use cargotest::ChannelChanger;
let p = project("foo")
.file("Cargo.toml", r#"
[package]
name = "foo"
authors = []
version = "0.0.1"
[dependencies]
serde = "1.0"
"#)
.file("src/main.rs", "fn main() {}")
.build();
assert_that(p.cargo("generate-lockfile"),
execs().with_status(0).with_stdout("")
.with_stderr_contains(" Updating registry `https://github.com/rust-lang/crates.io-index`"));
assert_that(p.cargo("generate-lockfile").masquerade_as_nightly_cargo().arg("-Zno-index-update"),
execs().with_status(0).with_stdout("")
.with_stderr_does_not_contain(" Updating registry `https://github.com/rust-lang/crates.io-index`"));
}
#[test]
fn preserve_metadata() {
let p = project("foo")