mood: Add support for the <text/> element.
This commit is contained in:
parent
3d495ccf41
commit
90063e5433
2 changed files with 15 additions and 2 deletions
12
src/mood.rs
12
src/mood.rs
|
|
@ -263,6 +263,11 @@ generate_element_enum!(
|
|||
}
|
||||
);
|
||||
|
||||
generate_elem_id!(
|
||||
/// Free-form text description of the mood.
|
||||
Text, "text", MOOD
|
||||
);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
@ -275,4 +280,11 @@ mod tests {
|
|||
let mood = MoodEnum::try_from(elem).unwrap();
|
||||
assert_eq!(mood, MoodEnum::Happy);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_text() {
|
||||
let elem: Element = "<text xmlns='http://jabber.org/protocol/mood'>Yay!</text>".parse().unwrap();
|
||||
let text = Text::try_from(elem).unwrap();
|
||||
assert_eq!(text.0, String::from("Yay!"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue