diff options
Diffstat (limited to 'src/tools/cargo/tests/testsuite/patch.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/patch.rs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/patch.rs b/src/tools/cargo/tests/testsuite/patch.rs index a467f60b5..a4522e822 100644 --- a/src/tools/cargo/tests/testsuite/patch.rs +++ b/src/tools/cargo/tests/testsuite/patch.rs @@ -2700,3 +2700,86 @@ perhaps a crate was updated and forgotten to be re-vendored?"#, ) .run(); } + +#[cargo_test] +fn from_config_empty() { + Package::new("bar", "0.1.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies] + bar = "0.1.0" + "#, + ) + .file( + ".cargo/config.toml", + r#" + [patch.''] + bar = { path = 'bar' } + "#, + ) + .file("src/lib.rs", "") + .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.1")) + .file("bar/src/lib.rs", r#""#) + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] [patch] entry `` should be a URL or registry name + +Caused by: + invalid url ``: relative URL without a base +", + ) + .run(); +} + +#[cargo_test] +fn from_manifest_empty() { + Package::new("bar", "0.1.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies] + bar = "0.1.0" + + [patch.''] + bar = { path = 'bar' } + "#, + ) + .file("src/lib.rs", "") + .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.1")) + .file("bar/src/lib.rs", r#""#) + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] failed to parse manifest at `[CWD]/Cargo.toml` + +Caused by: + [patch] entry `` should be a URL or registry name + +Caused by: + invalid url ``: relative URL without a base +", + ) + .run(); +} |