mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
fix(package): fix meson version extraction if 'meson_version' is present (#2397)
This commit is contained in:
parent
a2e7f6947f
commit
8f46dff9dc
@ -165,7 +165,7 @@ fn extract_maven_version(file_contents: &str) -> Option<String> {
|
||||
fn extract_meson_version(file_contents: &str) -> Option<String> {
|
||||
let file_contents = file_contents.split_ascii_whitespace().collect::<String>();
|
||||
|
||||
let re = Regex::new(r#"project\([^())]*version:'(?P<version>[^']+)'[^())]*\)"#).unwrap();
|
||||
let re = Regex::new(r#"project\([^())]*,version:'(?P<version>[^']+)'[^())]*\)"#).unwrap();
|
||||
let caps = re.captures(&file_contents)?;
|
||||
|
||||
let formatted_version = format_version(&caps["version"]);
|
||||
@ -756,6 +756,18 @@ end";
|
||||
project_dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_meson_version_with_meson_version() -> io::Result<()> {
|
||||
let config_name = "meson.build";
|
||||
let config_content =
|
||||
"project('starship', 'rust', version: '0.1.0', meson_version: '>= 0.57.0')".to_string();
|
||||
|
||||
let project_dir = create_project_dir()?;
|
||||
fill_config(&project_dir, config_name, Some(&config_content))?;
|
||||
expect_output(&project_dir, Some("v0.1.0"), None);
|
||||
project_dir.close()
|
||||
}
|
||||
|
||||
fn create_project_dir() -> io::Result<TempDir> {
|
||||
tempfile::tempdir()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user