added field language for MessageEntity
@@ -32,7 +32,7 @@ pub enum MessageEntityKind {
Bold,
Italic,
Code,
- Pre,
+ Pre { language: Option<String> },
TextLink { url: String },
TextMention { user: User },
Underline,
@@ -72,6 +72,25 @@ mod tests {
);
}
+ #[test]
+ fn pre() {
+ use serde_json::from_str;
+
+ assert_eq!(
+ MessageEntity {
+ kind: MessageEntityKind::Pre {
+ language: Some("rust".to_string()),
+ },
+ offset: 1,
+ length: 2,
+ },
+ from_str::<MessageEntity>(
+ r#"{"type":"pre","url":"ya.ru","offset":1,"length":2,"language":"rust"}"#
+ )
+ .unwrap()
+ );
+ }
+
#[test]
fn text_from() {
let message = message();
