feat(domain): restore must_use message; test TermRef accessors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 08:42:14 +02:00
parent 8cf737d8a9
commit d5ed2a261f
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ macro_rules! id_newtype {
impl $name {
/// Generate a fresh random id.
#[must_use]
#[must_use = "generating an id and discarding it is almost certainly a mistake"]
pub fn new() -> Self {
Self(uuid::Uuid::new_v4())
}
+15
View File
@@ -50,3 +50,18 @@ impl TermRef {
self.vocabulary_id
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{TermId, VocabularyId};
#[test]
fn term_ref_exposes_its_parts() {
let term_id = TermId::new();
let vocabulary_id = VocabularyId::new();
let r = TermRef::new(term_id, vocabulary_id);
assert_eq!(r.term_id(), term_id);
assert_eq!(r.vocabulary_id(), vocabulary_id);
}
}