Skip to content

Commit 255f622

Browse files
committed
feat(test): Allow setting resolver on published packages
1 parent 1a2df63 commit 255f622

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/cargo-test-support/src/registry.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ pub struct Package {
571571
local: bool,
572572
alternative: bool,
573573
invalid_json: bool,
574+
resolver: Option<String>,
574575
proc_macro: bool,
575576
links: Option<String>,
576577
rust_version: Option<String>,
@@ -1250,6 +1251,7 @@ impl Package {
12501251
local: false,
12511252
alternative: false,
12521253
invalid_json: false,
1254+
resolver: None,
12531255
proc_macro: false,
12541256
links: None,
12551257
rust_version: None,
@@ -1385,6 +1387,12 @@ impl Package {
13851387
self
13861388
}
13871389

1390+
/// Specifies `package.resolver`
1391+
pub fn resolver(&mut self, resolver: &str) -> &mut Package {
1392+
self.resolver = Some(resolver.to_owned());
1393+
self
1394+
}
1395+
13881396
/// Specifies whether or not this is a proc macro.
13891397
pub fn proc_macro(&mut self, proc_macro: bool) -> &mut Package {
13901398
self.proc_macro = proc_macro;
@@ -1570,7 +1578,11 @@ impl Package {
15701578
));
15711579

15721580
if let Some(version) = &self.rust_version {
1573-
manifest.push_str(&format!("rust-version = \"{}\"", version));
1581+
manifest.push_str(&format!("rust-version = \"{}\"\n", version));
1582+
}
1583+
1584+
if let Some(resolver) = &self.resolver {
1585+
manifest.push_str(&format!("resolver = \"{}\"\n", resolver));
15741586
}
15751587

15761588
if !self.features.is_empty() {

0 commit comments

Comments
 (0)