mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-01 12:34:28 +00:00
908ef96089
* Use typed Snowflakes if possible * Discord: make Snowflakes uint64 * Fix errors that emerged because of new typing
60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
package arguments
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestChannelMention(t *testing.T) {
|
|
test := new(ChannelMention)
|
|
str := "<#123123>"
|
|
id := 123123
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
t.Fatal("Expected", id, "error:", err)
|
|
}
|
|
|
|
if id := test.ID(); id != id {
|
|
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>"
|
|
id := 123123
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
t.Fatal("Expected", id, "error:", err)
|
|
}
|
|
|
|
if id := test.ID(); id != id {
|
|
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>"
|
|
id := 123123
|
|
|
|
if err := test.Parse(str); err != nil {
|
|
t.Fatal("Expected", id, "error:", err)
|
|
}
|
|
|
|
if id := test.ID(); id != id {
|
|
t.Fatal("Expected", id, "got", id)
|
|
}
|
|
|
|
if mention := test.Mention(); mention != str {
|
|
t.Fatal("Expected", str, "got", mention)
|
|
}
|
|
}
|