use tempfile::TempDir;
use test_case::test_case;
mod common;
#[test_case("2.3.4", "", "2.3.4")]
#[test_case("v3.4.5", "v", "3.4.5")]
#[test_case("version5.6.7", "version", "5.6.7")]
#[tokio::test]
async fn test_tag_prefix(tag_name: &str, prefix: &str, expected_version: &str) {
use tagver::{calculate_version, Config};
let temp_dir = TempDir::new().expect("Failed to create temp directory");
let path = temp_dir.path();
common::git::ensure_empty_repository_and_commit(path)
.await
.expect("Failed to create repo");
common::git::tag(path, tag_name)
.await
.expect("Failed to create tag");
let config = Config {
tag_prefix: prefix.to_string(),
..Default::default()
};
let result = calculate_version(path, &config).expect("Failed to calculate version");
assert_eq!(result.to_string(), expected_version);
}