From 28126c1d125e33aa3230f4c4ebea0a0ccb88340f Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 28 Sep 2015 22:30:40 -0700 Subject: [PATCH] Add a test for wildcard constraint warnings --- tests/test_cargo_package.rs | 58 ++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index 5ca6b1cf6..6e59a3647 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -9,7 +9,8 @@ use git2; use tar::Archive; use support::{project, execs, cargo_dir, paths, git, path2url}; -use support::{PACKAGING, VERIFYING, COMPILING, ARCHIVING}; +use support::{PACKAGING, VERIFYING, COMPILING, ARCHIVING, UPDATING, DOWNLOADING}; +use support::registry as r; use hamcrest::{assert_that, existing_file}; fn setup() { @@ -141,6 +142,61 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); dir = p.url()))); }); +test!(wildcard_deps { + r::init(); + + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + license = "MIT" + description = "foo" + repository = "bar" + + [dependencies] + bar = "*" + + [build-dependencies] + baz = "*" + + [dev-dependencies] + buz = "*" + "#) + .file("src/main.rs", "fn main() {}"); + + r::mock_pkg("baz", "0.0.1", &[]); + r::mock_pkg("bar", "0.0.1", &[("baz", "0.0.1", "normal")]); + r::mock_pkg("buz", "0.0.1", &[("bar", "0.0.1", "normal")]); + + assert_that(p.cargo_process("package"), + execs().with_status(0).with_stdout(&format!("\ +{packaging} foo v0.0.1 ({dir}) +{verifying} foo v0.0.1 ({dir}) +{updating} registry `{reg}` +{downloading} [..] v0.0.1 (registry file://[..]) +{downloading} [..] v0.0.1 (registry file://[..]) +{downloading} [..] v0.0.1 (registry file://[..]) +{compiling} baz v0.0.1 (registry file://[..]) +{compiling} bar v0.0.1 (registry file://[..]) +{compiling} foo v0.0.1 ({dir}[..]) +", + packaging = PACKAGING, + verifying = VERIFYING, + updating = UPDATING, + downloading = DOWNLOADING, + compiling = COMPILING, + dir = p.url(), + reg = r::registry())) + .with_stderr("\ +warning: some dependencies have wildcard (\"*\") version constraints. On December 11th, 2015, \ +crates.io will begin rejecting packages with wildcard dependency constraints. See \ +http://doc.crates.io/crates-io.html#using-crates.io-based-crates for information on version \ +constraints. +dependencies for these crates have wildcard constraints: bar, baz")); +}); + test!(package_verbose { let root = paths::root().join("all"); let p = git::repo(&root)