Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Jan 31, 2018
1 parent b83ef97 commit ba05437
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/generate-lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ba05437

Please sign in to comment.