#[derive(Debug, Clone)]
pub struct RefFieldSpec {
pub single_refs: &'static [&'static str],
pub list_refs: &'static [&'static str],
}
impl RefFieldSpec {
pub const DEFAULT: Self = Self {
single_refs: &["child", "activeTab"],
list_refs: &["children"],
};
}
impl Default for RefFieldSpec {
fn default() -> Self {
Self::DEFAULT
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_contains_expected_fields() {
let s = RefFieldSpec::DEFAULT;
assert!(s.single_refs.contains(&"child"));
assert!(s.single_refs.contains(&"activeTab"));
assert!(s.list_refs.contains(&"children"));
}
#[test]
fn default_impl_matches_const() {
assert_eq!(RefFieldSpec::default().single_refs, RefFieldSpec::DEFAULT.single_refs);
assert_eq!(RefFieldSpec::default().list_refs, RefFieldSpec::DEFAULT.list_refs);
}
}