mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Skip the language
field of MessageEntityKind::Pre
if it is None
This commit is contained in:
parent
fd4796deaf
commit
06a21ba9e1
1 changed files with 17 additions and 0 deletions
|
@ -44,6 +44,7 @@ impl MessageEntity {
|
|||
}
|
||||
}
|
||||
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(tag = "type")]
|
||||
|
@ -104,4 +105,20 @@ mod tests {
|
|||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_with_none_language() {
|
||||
use serde_json::to_string;
|
||||
|
||||
assert_eq!(
|
||||
to_string(&MessageEntity {
|
||||
kind: MessageEntityKind::Pre { language: None },
|
||||
offset: 1,
|
||||
length: 2,
|
||||
})
|
||||
.unwrap()
|
||||
.find("language"),
|
||||
None
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue