X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/6e3e9c5c10f3d35bae7e9846334974a09418aef7..cb514b662bcf9d90b2cf02789c989f777d774d3f:/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) {