Add missing tests
parent
c697a95948
commit
b8425b053e
|
@ -91,6 +91,15 @@ func TestCommandWithBotName(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCommandWithAtWithBotName(t *testing.T) {
|
||||||
|
message := tgbotapi.Message{Text: "/command@testbot"}
|
||||||
|
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 16}}
|
||||||
|
|
||||||
|
if message.CommandWithAt() != "command@testbot" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestMessageCommandArgumentsWithArguments(t *testing.T) {
|
func TestMessageCommandArgumentsWithArguments(t *testing.T) {
|
||||||
message := tgbotapi.Message{Text: "/command with arguments"}
|
message := tgbotapi.Message{Text: "/command with arguments"}
|
||||||
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||||
|
@ -99,6 +108,14 @@ func TestMessageCommandArgumentsWithArguments(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMessageCommandArgumentsWithMalformedArguments(t *testing.T) {
|
||||||
|
message := tgbotapi.Message{Text: "/command-without argument space"}
|
||||||
|
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||||
|
if message.CommandArguments() != "without argument space" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestMessageCommandArgumentsWithoutArguments(t *testing.T) {
|
func TestMessageCommandArgumentsWithoutArguments(t *testing.T) {
|
||||||
message := tgbotapi.Message{Text: "/command"}
|
message := tgbotapi.Message{Text: "/command"}
|
||||||
if message.CommandArguments() != "" {
|
if message.CommandArguments() != "" {
|
||||||
|
|
Loading…
Reference in New Issue