2020-02-04 16:13:11 +00:00
|
|
|
package arguments
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-07-29 23:29:01 +00:00
|
|
|
|
2021-06-02 02:53:19 +00:00
|
|
|
"github.com/diamondburned/arikawa/v3/discord"
|
2020-02-04 16:13:11 +00:00
|
|
|
)
|
|
|
|
|
2020-07-29 20:58:39 +00:00
|
|
|
func TestChannelMention(t *testing.T) {
|
|
|
|
test := new(ChannelMention)
|
|
|
|
str := "<#123123>"
|
2020-07-29 23:29:01 +00:00
|
|
|
var id discord.ChannelID = 123123
|
2020-07-29 20:58:39 +00:00
|
|
|
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
|
|
t.Fatal("Expected", id, "error:", err)
|
|
|
|
}
|
|
|
|
|
2020-07-29 23:29:01 +00:00
|
|
|
if actualID := test.ID(); actualID != id {
|
2020-07-29 20:58:39 +00:00
|
|
|
t.Fatal("Expected", id, "got", id)
|
|
|
|
}
|
|
|
|
|
|
|
|
if mention := test.Mention(); mention != str {
|
|
|
|
t.Fatal("Expected", str, "got", mention)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestUserMention(t *testing.T) {
|
|
|
|
test := new(UserMention)
|
|
|
|
str := "<@123123>"
|
2020-07-29 23:29:01 +00:00
|
|
|
var id discord.UserID = 123123
|
2020-07-29 20:58:39 +00:00
|
|
|
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
|
|
t.Fatal("Expected", id, "error:", err)
|
|
|
|
}
|
|
|
|
|
2020-07-29 23:29:01 +00:00
|
|
|
if actualID := test.ID(); actualID != id {
|
2020-07-29 20:58:39 +00:00
|
|
|
t.Fatal("Expected", id, "got", id)
|
|
|
|
}
|
|
|
|
|
|
|
|
if mention := test.Mention(); mention != str {
|
|
|
|
t.Fatal("Expected", str, "got", mention)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRoleMention(t *testing.T) {
|
|
|
|
test := new(RoleMention)
|
|
|
|
str := "<@&123123>"
|
2020-07-29 23:29:01 +00:00
|
|
|
var id discord.RoleID = 123123
|
2020-07-29 20:58:39 +00:00
|
|
|
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
|
|
t.Fatal("Expected", id, "error:", err)
|
|
|
|
}
|
|
|
|
|
2020-07-29 23:29:01 +00:00
|
|
|
if actualID := test.ID(); actualID != id {
|
2020-07-29 20:58:39 +00:00
|
|
|
t.Fatal("Expected", id, "got", id)
|
|
|
|
}
|
|
|
|
|
|
|
|
if mention := test.Mention(); mention != str {
|
|
|
|
t.Fatal("Expected", str, "got", mention)
|
2020-02-04 16:13:11 +00:00
|
|
|
}
|
|
|
|
}
|