emote: parse emote structs, not just ids

This commit is contained in:
2025-04-19 19:17:35 -04:00
parent 5c530a41fb
commit 76fc85b7c0
2 changed files with 15 additions and 15 deletions

View File

@@ -57,16 +57,16 @@ func TestParser(t *testing.T) {
var got []string
text := c.text
for {
name, id, rest := p.Next(text)
if id == "" {
em, rest := p.Next(text)
if em.ID == "" {
break
}
if name != id {
if em.Name != em.ID {
// Not normally the case, but this test is constructed
// so that it is.
t.Errorf("wrong id %q for name %q", id, name)
t.Errorf("wrong id %q for name %q", em.ID, em.Name)
}
got = append(got, name)
got = append(got, em.Name)
text = rest
}
if diff := cmp.Diff(c.want, got); diff != "" {
@@ -103,7 +103,7 @@ func BenchmarkParser(b *testing.B) {
for b.Loop() {
text := c.text
for text != "" {
_, _, text = p.Next(text)
_, text = p.Next(text)
}
}
})