use tempfile::TempDir;
use test_case::test_case;
mod common;
#[test_case("alpha.0", "0.0.0-alpha.0")]
#[test_case("preview.x", "0.0.0-preview.x")]
#[tokio::test]
async fn test_various_identifiers(identifiers: &str, expected_version: &str) {
use tagver::{calculate_version_with_fallback, 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");
let identifier_list: Vec<String> = identifiers.split('.').map(|s| s.to_string()).collect();
let config = Config {
default_prerelease_identifiers: identifier_list,
..Default::default()
};
let result =
calculate_version_with_fallback(path, &config).expect("Failed to calculate version");
assert_eq!(result.to_string(), expected_version);
}