Reset session when cloned.
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit

This commit is contained in:
Jeff Baskin 2024-11-06 21:28:44 -05:00
parent 52b6506088
commit fc88177d75

View File

@ -39,7 +39,6 @@ mod test_message {
} }
/// Application client to MoreThanText /// Application client to MoreThanText
#[derive(Clone)]
pub struct MoreThanText { pub struct MoreThanText {
session: Option<SessionData>, session: Option<SessionData>,
tx: Sender<Message>, tx: Sender<Message>,
@ -115,6 +114,15 @@ impl MoreThanText {
} }
} }
impl Clone for MoreThanText {
fn clone(&self) -> Self {
Self {
session: None,
tx: self.tx.clone(),
}
}
}
#[cfg(test)] #[cfg(test)]
mod mtt_client { mod mtt_client {
use super::*; use super::*;
@ -140,4 +148,12 @@ mod mtt_client {
mtt.open_session(None); mtt.open_session(None);
assert_ne!(mtt.get_id(), id1); assert_ne!(mtt.get_id(), id1);
} }
#[test]
fn cloned_clients_have_no_session() {
let mut mtt = MoreThanText::new();
mtt.open_session(None);
let result = mtt.clone();
assert!(result.session.is_none());
}
} }