No reason to use pointers to arrays.
This commit is contained in:
parent
4d758f17d4
commit
cdcb93df5f
4 changed files with 27 additions and 27 deletions
|
@ -47,7 +47,7 @@ func TestMessageTime(t *testing.T) {
|
|||
|
||||
func TestMessageIsCommandWithCommand(t *testing.T) {
|
||||
message := tgbotapi.Message{Text: "/command"}
|
||||
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||
message.Entities = []tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||
|
||||
if !message.IsCommand() {
|
||||
t.Fail()
|
||||
|
@ -72,7 +72,7 @@ func TestIsCommandWithEmptyText(t *testing.T) {
|
|||
|
||||
func TestCommandWithCommand(t *testing.T) {
|
||||
message := tgbotapi.Message{Text: "/command"}
|
||||
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||
message.Entities = []tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||
|
||||
if message.Command() != "command" {
|
||||
t.Fail()
|
||||
|
@ -97,7 +97,7 @@ func TestCommandWithNonCommand(t *testing.T) {
|
|||
|
||||
func TestCommandWithBotName(t *testing.T) {
|
||||
message := tgbotapi.Message{Text: "/command@testbot"}
|
||||
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 16}}
|
||||
message.Entities = []tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 16}}
|
||||
|
||||
if message.Command() != "command" {
|
||||
t.Fail()
|
||||
|
@ -106,7 +106,7 @@ 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}}
|
||||
message.Entities = []tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 16}}
|
||||
|
||||
if message.CommandWithAt() != "command@testbot" {
|
||||
t.Fail()
|
||||
|
@ -115,7 +115,7 @@ func TestCommandWithAtWithBotName(t *testing.T) {
|
|||
|
||||
func TestMessageCommandArgumentsWithArguments(t *testing.T) {
|
||||
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}}
|
||||
if message.CommandArguments() != "with arguments" {
|
||||
t.Fail()
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ 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}}
|
||||
message.Entities = []tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||
if message.CommandArguments() != "without argument space" {
|
||||
t.Fail()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue