X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/47f69638bc96100f2e446f63c7c3689023156e64..eeb821ff17ad79c87ca9b64cd9be26f8612f4a03:/turn_test.go?ds=inline diff --git a/turn_test.go b/turn_test.go index 928ac33..b0417cf 100644 --- a/turn_test.go +++ b/turn_test.go @@ -308,16 +308,21 @@ func (r *TurnEventRecorder) Count(kind string) int { // Last returns the text of the last event of kind. func (r *TurnEventRecorder) Last(kind string) string { + return r.LastEvent(kind).Text +} + +// LastEvent returns the last event of kind. +func (r *TurnEventRecorder) LastEvent(kind string) Event { r.mutex.Lock() defer r.mutex.Unlock() for n := len(r.events) - 1; n >= 0; n-- { if r.events[n].Kind == kind { - return r.events[n].Text + return r.events[n] } } - return "" + return Event{} } func (r *TurnEventRecorder) Add(event Event) {