Skip to content

Commit 2d23b94

Browse files
committed
test(base): Verify bases in patches in virtual manifests
1 parent e83dc04 commit 2d23b94

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

tests/testsuite/patch.rs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3038,7 +3038,7 @@ foo v0.0.0 ([ROOT]/foo)
30383038
}
30393039

30403040
#[cargo_test]
3041-
fn patch_with_base() {
3041+
fn patch_in_real_with_base() {
30423042
let bar = project()
30433043
.at("bar")
30443044
.file("Cargo.toml", &basic_manifest("bar", "0.5.0"))
@@ -3087,3 +3087,70 @@ foo v0.5.0 ([ROOT]/foo)
30873087
"#]])
30883088
.run();
30893089
}
3090+
3091+
#[cargo_test]
3092+
fn patch_in_virtual_with_base() {
3093+
let bar = project()
3094+
.at("bar")
3095+
.file("Cargo.toml", &basic_manifest("bar", "0.5.0"))
3096+
.file("src/lib.rs", "pub fn hello() {}")
3097+
.build();
3098+
Package::new("bar", "0.5.0").publish();
3099+
3100+
let p = project()
3101+
.file(
3102+
".cargo/config.toml",
3103+
&format!(
3104+
r#"
3105+
[path-bases]
3106+
test = '{}'
3107+
"#,
3108+
bar.root().parent().unwrap().display()
3109+
),
3110+
)
3111+
.file(
3112+
"Cargo.toml",
3113+
r#"
3114+
cargo-features = ["path-bases"]
3115+
3116+
[workspace]
3117+
members = ["foo"]
3118+
3119+
[patch.crates-io]
3120+
bar = { base = 'test', path = 'bar' }
3121+
"#,
3122+
)
3123+
.file(
3124+
"foo/Cargo.toml",
3125+
r#"
3126+
[package]
3127+
name = "foo"
3128+
version = "0.5.0"
3129+
authors = ["[email protected]"]
3130+
edition = "2018"
3131+
3132+
[dependencies]
3133+
bar = "0.5.0"
3134+
"#,
3135+
)
3136+
.file("foo/src/lib.rs", "use bar::hello as _;")
3137+
.build();
3138+
3139+
p.cargo("tree")
3140+
.masquerade_as_nightly_cargo(&["path-bases"])
3141+
.with_status(101)
3142+
.with_stderr_data(str![[r#"
3143+
[ERROR] failed to load source for dependency `bar`
3144+
3145+
Caused by:
3146+
Unable to update [ROOT]/foo/bar
3147+
3148+
Caused by:
3149+
failed to read `[ROOT]/foo/bar/Cargo.toml`
3150+
3151+
Caused by:
3152+
[NOT_FOUND]
3153+
3154+
"#]])
3155+
.run();
3156+
}

0 commit comments

Comments
 (0)