emote: parse emote structs, not just ids
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user