Add missing tests
This commit is contained in:
parent
c697a95948
commit
b8425b053e
1 changed files with 17 additions and 0 deletions
|
@ -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) {
|
||||
message := tgbotapi.Message{Text: "/command with arguments"}
|
||||
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) {
|
||||
message := tgbotapi.Message{Text: "/command"}
|
||||
if message.CommandArguments() != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue