package common
import (
"os"
"testing"
)
var data_good = map[string]string{
"one": `
`,
"two": `
`,
"three": `
`,
":one:": `
`,
":two:": `
`,
":three:": `
`,
":one::one:": `![one](/emotes/one.png)
`,
":one:one:": `
one:`,
"oneone": "oneone",
"one:one:": `one
`,
"[one]": `
`,
"[two]": `
`,
"[three]": `
`,
"[one][one]": `![one](/emotes/one.png)
`,
"[one]one": `
one`,
":one: two [three]": `
`,
"nope one what": `nope
what`,
"nope :two: what": `nope
what`,
"nope [three] what": `nope
what`,
}
var data_wrapped = map[string]string{
"one": `one`,
"two": `two`,
"three": `three`,
":one:": `
`,
":two:": `
`,
":three:": `
`,
":one::one:": `![one](/emotes/one.png)
`,
":one:one:": `
one:`,
"oneone": "oneone",
"one:one:": `one
`,
"[one]": `
`,
"[two]": `
`,
"[three]": `
`,
"[one][one]": `![one](/emotes/one.png)
`,
"[one]one": `
one`,
":one: two [three]": `
two
`,
"nope one what": `nope one what`,
"nope :two: what": `nope
what`,
"nope [three] what": `nope
what`,
}
func TestMain(m *testing.M) {
Emotes = map[string]string{
"one": "/emotes/one.png",
"two": "/emotes/two.png",
"three": "/emotes/three.gif",
}
os.Exit(m.Run())
}
func TestEmotes_ParseEmotes(t *testing.T) {
for input, expected := range data_good {
got := ParseEmotes(input)
if got != expected {
t.Errorf("%s failed to parse into %q. Received: %q", input, expected, got)
}
}
}
func TestEmotes_ParseEmotes_WrappedOnly(t *testing.T) {
for input, expected := range data_good {
got := ParseEmotes(input)
if got != expected {
t.Errorf("%s failed to parse into %q. Received: %q", input, expected, got)
}
}
}