aboutsummaryrefslogtreecommitdiff
path: root/telegram/formatter/formatter_test.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-03-11 20:01:38 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-03-11 20:01:38 +0300
commitcdbd960ff4337e2ee3bab877958c99ce6d63958d (patch)
treed6e925f9e66bcc064cce9c712b0e9fd3d139d333 /telegram/formatter/formatter_test.go
parentf6e62fe1fd208cba8214db70fe1ebbdc9bb41115 (diff)
Wrap inline code in single backticks
Diffstat (limited to 'telegram/formatter/formatter_test.go')
-rw-r--r--telegram/formatter/formatter_test.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/telegram/formatter/formatter_test.go b/telegram/formatter/formatter_test.go
index 5ac6262..5e3cdf0 100644
--- a/telegram/formatter/formatter_test.go
+++ b/telegram/formatter/formatter_test.go
@@ -64,7 +64,7 @@ func TestFormattingAdjacentAndNested(t *testing.T) {
Type: &client.TextEntityTypeItalic{},
},
}, EntityToMarkdown)
- if markup != "\n```\n**👙**🐧\n```\n_🐖_" {
+ if markup != "```\n**👙**🐧\n```_🐖_" {
t.Errorf("Wrong adjacent&nested formatting: %v", markup)
}
}
@@ -265,7 +265,7 @@ func TestFormattingXEP0393AdjacentAndNested(t *testing.T) {
Type: &client.TextEntityTypeItalic{},
},
}, EntityToXEP0393)
- if markup != "\n```\n*👙*🐧\n```\n_🐖_" {
+ if markup != "```\n*👙*🐧\n```_🐖_" {
t.Errorf("Wrong adjacent&nested formatting: %v", markup)
}
}
@@ -348,3 +348,21 @@ func TestFormattingXEP0393Intersecting(t *testing.T) {
t.Errorf("Wrong intersecting formatting: %v", markup)
}
}
+
+func TestFormattingXEP0393InlineCode(t *testing.T) {
+ markup := Format("Is Gajim a thing?\n\necho 'Hello'\necho 'world'\n\nhruck(", []*client.TextEntity{
+ &client.TextEntity{
+ Offset: 3,
+ Length: 5,
+ Type: &client.TextEntityTypeCode{},
+ },
+ &client.TextEntity{
+ Offset: 19,
+ Length: 25,
+ Type: &client.TextEntityTypePre{},
+ },
+ }, EntityToXEP0393)
+ if markup != "Is `Gajim` a thing?\n\n```\necho 'Hello'\necho 'world'\n```\n\nhruck(" {
+ t.Errorf("Wrong intersecting formatting: %v", markup)
+ }
+}