Skip to content

Commit 646e29a

Browse files
committed
feat(test): Allow setting edition on published packages
1 parent 255f622 commit 646e29a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
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+
edition: Option<String>,
574575
resolver: Option<String>,
575576
proc_macro: bool,
576577
links: Option<String>,
@@ -1251,6 +1252,7 @@ impl Package {
12511252
local: false,
12521253
alternative: false,
12531254
invalid_json: false,
1255+
edition: None,
12541256
resolver: None,
12551257
proc_macro: false,
12561258
links: None,
@@ -1387,6 +1389,12 @@ impl Package {
13871389
self
13881390
}
13891391

1392+
/// Specifies `package.edition`
1393+
pub fn edition(&mut self, edition: &str) -> &mut Package {
1394+
self.edition = Some(edition.to_owned());
1395+
self
1396+
}
1397+
13901398
/// Specifies `package.resolver`
13911399
pub fn resolver(&mut self, resolver: &str) -> &mut Package {
13921400
self.resolver = Some(resolver.to_owned());
@@ -1581,6 +1589,10 @@ impl Package {
15811589
manifest.push_str(&format!("rust-version = \"{}\"\n", version));
15821590
}
15831591

1592+
if let Some(edition) = &self.edition {
1593+
manifest.push_str(&format!("edition = \"{}\"\n", edition));
1594+
}
1595+
15841596
if let Some(resolver) = &self.resolver {
15851597
manifest.push_str(&format!("resolver = \"{}\"\n", resolver));
15861598
}

0 commit comments

Comments
 (0)