Added method of updating the name id.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
parent
672ed93da3
commit
8b269836c2
@ -291,6 +291,10 @@ impl Message {
|
||||
)
|
||||
}
|
||||
|
||||
fn reset_name_id<NT>(&mut self, name: NT) where NT: Into<NameType> {
|
||||
self.document_id = name.into();
|
||||
}
|
||||
|
||||
fn response<A>(&self, action: A) -> Self
|
||||
where
|
||||
A: Into<MsgAction>,
|
||||
@ -414,6 +418,18 @@ mod messages {
|
||||
_ => unreachable!("got {:?}: should have received a reply", action2),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_reset_document_id() {
|
||||
let mut msg = Message::new(Name::english("something"), Query::new());
|
||||
let id = Uuid::new_v4();
|
||||
msg.reset_name_id(&id);
|
||||
let name_id = msg.get_document_id();
|
||||
match name_id {
|
||||
NameType::ID(data) => assert_eq!(data, &id),
|
||||
_ => unreachable!("got {:?}, should have been an id", name_id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user