From: Eh2406 Date: Wed, 31 Jan 2018 21:12:19 +0000 (-0500) Subject: add a test X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~3^2~18^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ba054375543aef7e248556e383a66ee31a544ce2;p=cargo.git add a test --- diff --git a/tests/generate-lockfile.rs b/tests/generate-lockfile.rs index 56f853018..2a6459602 100644 --- a/tests/generate-lockfile.rs +++ b/tests/generate-lockfile.rs @@ -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")