mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(version): strip punctuation when scanning minimum semver
Treat trailing sentence punctuation as non-semver noise when extracting the minimum wire-compat version from announcement_tip.toml. Refs #539
This commit is contained in:
@@ -40,7 +40,7 @@ fn extract_max_semver(input: &'static str) -> Option<&'static str> {
|
||||
|
||||
for token in input.split_whitespace() {
|
||||
let candidate = token.trim_matches(|ch: char| {
|
||||
!(ch.is_ascii_alphanumeric() || matches!(ch, '.' | '-' | '+' | 'v'))
|
||||
!(ch.is_ascii_alphanumeric() || matches!(ch, '-' | '+' | 'v'))
|
||||
});
|
||||
if candidate.is_empty() {
|
||||
continue;
|
||||
@@ -128,6 +128,12 @@ mod tests {
|
||||
assert_eq!(extract_max_semver(input), Some("0.102.1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_max_semver_strips_sentence_punctuation() {
|
||||
let input = "Upgrade to 0.99.0. Then 0.98.1.";
|
||||
assert_eq!(extract_max_semver(input), Some("0.99.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn configured_minimum_defaults_to_semver() {
|
||||
assert!(parse_semver_triplet(min_wire_compat_version()).is_some());
|
||||
|
||||
Reference in New Issue
Block a user