#[derive(Debug, Clone)]
pub enum ModelSpec {
Exact(String),
Inherit,
}
impl ModelSpec {
pub fn resolve(&self, parent_model: &str) -> String {
match self {
Self::Exact(id) => id.clone(),
Self::Inherit => parent_model.to_string(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn resolve_exact_returns_id() {
assert_eq!(ModelSpec::Exact("custom".into()).resolve("parent"), "custom");
}
#[test]
fn resolve_inherit_uses_parent() {
assert_eq!(ModelSpec::Inherit.resolve("my-parent-model"), "my-parent-model");
}
}