diff --git a/tests/cargo-list.rs b/tests/cargo-list.rs index 130220ee35..263ee45cc7 100644 --- a/tests/cargo-list.rs +++ b/tests/cargo-list.rs @@ -1,6 +1,20 @@ #[macro_use] extern crate assert_cli; +#[test] +fn listing() { + assert_cli!("target/debug/cargo-list", + &["list", "--manifest-path=tests/fixtures/list/Cargo.toml"] => + Success, r#"cargo-edit path: "../../../" +clippy git: "https://github.com/Manishearth/rust-clippy.git" (optional) +docopt 0.6 +pad 0.1 +rustc-serialize 0.3 +semver 0.1 +toml 0.1"#) + .unwrap(); +} + #[test] fn listing_dev() { assert_cli!("target/debug/cargo-list", @@ -18,17 +32,21 @@ fn listing_build() { } #[test] -fn listing() { +fn treat_missing_section_as_empty() { + // empty dependencies assert_cli!("target/debug/cargo-list", - &["list", "--manifest-path=tests/fixtures/list/Cargo.toml"] => - Success, r#"cargo-edit path: "../../../" -clippy git: "https://github.com/Manishearth/rust-clippy.git" (optional) -docopt 0.6 -pad 0.1 -rustc-serialize 0.3 -semver 0.1 -toml 0.1"#) - .unwrap(); + &["list", "--manifest-path=tests/fixtures/list-empty/Cargo.toml"] => + Success, "\n").unwrap(); + + // empty dev-dependencies + assert_cli!("target/debug/cargo-list", + &["list", "--dev", "--manifest-path=tests/fixtures/list-empty/Cargo.toml"] => + Success, "\n").unwrap(); + + // empty build-dependencies + assert_cli!("target/debug/cargo-list", + &["list", "--build", "--manifest-path=tests/fixtures/list-empty/Cargo.toml"] => + Success, "\n").unwrap(); } #[test] diff --git a/tests/fixtures/list-empty/Cargo.toml b/tests/fixtures/list-empty/Cargo.toml new file mode 100644 index 0000000000..6915b5b336 --- /dev/null +++ b/tests/fixtures/list-empty/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "cargo-list-empty-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs"