Subscribing to events should not bump event ID (fixes #2329)

This commit is contained in:
Jakob Borg
2015-10-02 07:59:24 +02:00
parent beb643c666
commit d746b043c8
2 changed files with 15 additions and 10 deletions
+3 -2
View File
@@ -134,6 +134,7 @@ func TestIDs(t *testing.T) {
s := l.Subscribe(events.AllEvents)
defer l.Unsubscribe(s)
l.Log(events.DeviceConnected, "foo")
_ = l.Subscribe(events.AllEvents)
l.Log(events.DeviceConnected, "bar")
ev, err := s.Poll(timeout)
@@ -152,8 +153,8 @@ func TestIDs(t *testing.T) {
if ev.Data.(string) != "bar" {
t.Fatal("Incorrect event:", ev)
}
if !(ev.ID > id) {
t.Fatalf("ID not incremented (%d !> %d)", ev.ID, id)
if ev.ID != id+1 {
t.Fatalf("ID not incremented (%d != %d)", ev.ID, id+1)
}
}