From 5514bc9d16ae4f6c4d26cb66945a5027b93ebcfe Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Fri, 11 Mar 2022 12:54:03 -0500 Subject: Add strikethrough formatting --- telegram/formatter/formatter_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'telegram/formatter/formatter_test.go') diff --git a/telegram/formatter/formatter_test.go b/telegram/formatter/formatter_test.go index 5e3cdf0..c988b10 100644 --- a/telegram/formatter/formatter_test.go +++ b/telegram/formatter/formatter_test.go @@ -366,3 +366,29 @@ func TestFormattingXEP0393InlineCode(t *testing.T) { t.Errorf("Wrong intersecting formatting: %v", markup) } } + +func TestFormattingMarkdownStrikethrough(t *testing.T) { + markup := Format("Everyone dislikes cake.", []*client.TextEntity{ + &client.TextEntity{ + Offset: 9, + Length: 3, + Type: &client.TextEntityTypeStrikethrough{}, + }, + }, EntityToMarkdown) + if markup != "Everyone ~~dis~~likes cake." { + t.Errorf("Wrong strikethrough formatting: %v", markup) + } +} + +func TestFormattingXEP0393Strikethrough(t *testing.T) { + markup := Format("Everyone dislikes cake.", []*client.TextEntity{ + &client.TextEntity{ + Offset: 9, + Length: 3, + Type: &client.TextEntityTypeStrikethrough{}, + }, + }, EntityToXEP0393) + if markup != "Everyone ~dis~likes cake." { + t.Errorf("Wrong strikethrough formatting: %v", markup) + } +} -- cgit v1.2.3