| 1 | package sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/ |
| 2 | |
| 3 | import ( |
| 4 | "syncscip-go gomod github.com/golang/go/src go1.16 sync/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.16 testing/" |
| 6 | "timescip-go gomod github.com/golang/go/src go1.16 time/" |
| 7 | ) |
| 8 | |
| 9 | func TestNewEventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestNewEvent().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 10 | |
| 11 | type args struct { |
| 12 | tag string |
| 13 | data interface{} |
| 14 | } |
| 15 | tests := []struct { |
| 16 | name string |
| 17 | args args |
| 18 | want Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 19 | }{ |
| 20 | { |
| 21 | name: "Create new event with nil data", |
| 22 | args: args{"tag", nil}, |
| 23 | want: Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.: "tag", Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.: nil}, |
| 24 | }, |
| 25 | { |
| 26 | name: "Create new event with string data", |
| 27 | args: args{"tag", "test string"}, |
| 28 | want: Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.: "tag", Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.: "test string"}, |
| 29 | }, |
| 30 | } |
| 31 | for _, tt := range tests { |
| 32 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 33 | got := NewEventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/NewEvent().(tt.args.tag, tt.args.data) |
| 34 | if got.Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data. != tt.args.data { |
| 35 | t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("Expected %+v data, got %+v", tt.args.data, got.Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.) |
| 36 | } |
| 37 | if got.Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag. != tt.args.tag { |
| 38 | t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("Expected %+v Tag, got %+v", tt.args.tag, got.Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.) |
| 39 | } |
| 40 | }) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestNewEventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestNewEventPool().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 45 | type args struct { |
| 46 | debug bool |
| 47 | silent bool |
| 48 | } |
| 49 | tests := []struct { |
| 50 | name string |
| 51 | args args |
| 52 | want *EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool# |
| 53 | }{ |
| 54 | { |
| 55 | name: "Test creating debug event pool", |
| 56 | args: args{true, false}, |
| 57 | want: &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: true, silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: false}, |
| 58 | }, |
| 59 | { |
| 60 | name: "Test creating silent and event pool", |
| 61 | args: args{true, false}, |
| 62 | want: &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: true, silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: false}, |
| 63 | }, |
| 64 | // { |
| 65 | // name: "Test creating silent and debug event pool", |
| 66 | // args: args{true, true}, |
| 67 | // want: nil, |
| 68 | // }, |
| 69 | } |
| 70 | for _, tt := range tests { |
| 71 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 72 | got := NewEventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/NewEventPool().(tt.args.debug, tt.args.silent) |
| 73 | if got == nil { |
| 74 | t.Fatalscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatal().("NewEventPool() returned unexpected nil") |
| 75 | } |
| 76 | if got.silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent. != tt.want.silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent. { |
| 77 | t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("Didn't get correct silent var %v, want %v", got.silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent., tt.want.silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.) |
| 78 | } |
| 79 | }) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func TestEventPool_SetSilentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestEventPool_SetSilent().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 84 | type fields struct { |
| 85 | Mutex *syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex# |
| 86 | debug bool |
| 87 | silent bool |
| 88 | events []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 89 | listeners []chan Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 90 | } |
| 91 | type args struct { |
| 92 | s bool |
| 93 | } |
| 94 | tests := []struct { |
| 95 | name string |
| 96 | fields fields |
| 97 | args args |
| 98 | }{ |
| 99 | { |
| 100 | name: "Set silent on non-silent event pool", |
| 101 | fields: fields{silent: false, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 102 | args: args{s: true}, |
| 103 | }, |
| 104 | { |
| 105 | name: "Set silent on silent event pool", |
| 106 | fields: fields{silent: true, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 107 | args: args{s: true}, |
| 108 | }, |
| 109 | { |
| 110 | name: "Set non-silent on non-silent event pool", |
| 111 | fields: fields{silent: false, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 112 | args: args{s: false}, |
| 113 | }, |
| 114 | { |
| 115 | name: "Set silent on silent event pool", |
| 116 | fields: fields{silent: true, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 117 | args: args{s: false}, |
| 118 | }, |
| 119 | { |
| 120 | name: "Set silent on non-silent and debug event pool", |
| 121 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 122 | args: args{s: true}, |
| 123 | }, |
| 124 | { |
| 125 | name: "Set non-silent on non-silent and debug event pool", |
| 126 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 127 | args: args{s: false}, |
| 128 | }, |
| 129 | } |
| 130 | for _, tt := range tests { |
| 131 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 132 | p := &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{ |
| 133 | Mutexscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Mutex.: tt.fields.Mutex, |
| 134 | debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: tt.fields.debug, |
| 135 | silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: tt.fields.silent, |
| 136 | eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.: tt.fields.events, |
| 137 | listenersscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#listeners.: tt.fields.listeners, |
| 138 | } |
| 139 | p.SetSilentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#SetSilent().(tt.args.s) |
| 140 | if p.silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent. != tt.args.s { |
| 141 | t.Errorscip-go gomod github.com/golang/go/src go1.16 testing/common#Error().("p.SetSilent didn't set the eventpool to silent") |
| 142 | } |
| 143 | }) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func TestEventPool_SetDebugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestEventPool_SetDebug().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 148 | type fields struct { |
| 149 | Mutex *syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex# |
| 150 | debug bool |
| 151 | silent bool |
| 152 | events []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 153 | listeners []chan Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 154 | } |
| 155 | |
| 156 | type args struct { |
| 157 | s bool |
| 158 | } |
| 159 | |
| 160 | tests := []struct { |
| 161 | name string |
| 162 | fields fields |
| 163 | args args |
| 164 | }{ |
| 165 | { |
| 166 | name: "Set debug on non-debug event pool", |
| 167 | fields: fields{silent: false, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 168 | args: args{s: true}, |
| 169 | }, |
| 170 | { |
| 171 | name: "Set debug on debug event pool", |
| 172 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 173 | args: args{s: true}, |
| 174 | }, |
| 175 | { |
| 176 | name: "Set non-debug on non-debug event pool", |
| 177 | fields: fields{silent: false, debug: false, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 178 | args: args{s: false}, |
| 179 | }, |
| 180 | { |
| 181 | name: "Set non-debug on debug event pool", |
| 182 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 183 | args: args{s: false}, |
| 184 | }, |
| 185 | { |
| 186 | name: "Set silent on non-silent and debug event pool", |
| 187 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 188 | args: args{s: true}, |
| 189 | }, |
| 190 | { |
| 191 | name: "Set non-silent on non-silent and debug event pool", |
| 192 | fields: fields{silent: false, debug: true, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 193 | args: args{s: true}, |
| 194 | }, |
| 195 | } |
| 196 | for _, tt := range tests { |
| 197 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 198 | p := &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{ |
| 199 | Mutexscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Mutex.: tt.fields.Mutex, |
| 200 | debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: tt.fields.debug, |
| 201 | silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: tt.fields.silent, |
| 202 | eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.: tt.fields.events, |
| 203 | listenersscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#listeners.: tt.fields.listeners, |
| 204 | } |
| 205 | p.SetDebugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#SetDebug().(tt.args.s) |
| 206 | if p.debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug. != tt.args.s { |
| 207 | t.Errorscip-go gomod github.com/golang/go/src go1.16 testing/common#Error().("p.SetDebug didn't set the eventpool to debug") |
| 208 | } |
| 209 | }) |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | func TestEventPool_Clearscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestEventPool_Clear().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 214 | type fields struct { |
| 215 | Mutex *syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex# |
| 216 | debug bool |
| 217 | silent bool |
| 218 | events []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 219 | listeners []chan Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 220 | } |
| 221 | |
| 222 | tests := []struct { |
| 223 | name string |
| 224 | fields fields |
| 225 | }{ |
| 226 | { |
| 227 | name: "Clear events on empty list", |
| 228 | fields: fields{debug: false, silent: false, events: []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{}, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 229 | }, |
| 230 | { |
| 231 | name: "Clear events", |
| 232 | fields: fields{debug: false, silent: false, events: []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{{Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.: "meh", Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.: "something", Timescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Time.: timescip-go gomod github.com/golang/go/src go1.16 time/.Nowscip-go gomod github.com/golang/go/src go1.16 time/Now().()}}, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 233 | }, |
| 234 | } |
| 235 | for _, tt := range tests { |
| 236 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 237 | p := &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{ |
| 238 | Mutexscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Mutex.: tt.fields.Mutex, |
| 239 | debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: tt.fields.debug, |
| 240 | silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: tt.fields.silent, |
| 241 | eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.: tt.fields.events, |
| 242 | listenersscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#listeners.: tt.fields.listeners, |
| 243 | } |
| 244 | p.Clearscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Clear().() |
| 245 | if len(p.eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.) != 0 { |
| 246 | t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("Expected empty list after clear, got %d", len(p.eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.)) |
| 247 | } |
| 248 | }) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | func TestEventPool_Addscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/TestEventPool_Add().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 253 | type fields struct { |
| 254 | Mutex *syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex# |
| 255 | debug bool |
| 256 | silent bool |
| 257 | events []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 258 | listeners []chan Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event# |
| 259 | } |
| 260 | type args struct { |
| 261 | tag string |
| 262 | data interface{} |
| 263 | } |
| 264 | tests := []struct { |
| 265 | name string |
| 266 | fields fields |
| 267 | args args |
| 268 | }{ |
| 269 | { |
| 270 | name: "Add event with nil data on empty event list", |
| 271 | fields: fields{debug: false, silent: false, events: []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{}, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 272 | args: args{tag: "tag with empty data", data: nil}, |
| 273 | }, |
| 274 | { |
| 275 | name: "Add event with nil data", |
| 276 | fields: fields{debug: false, silent: false, events: []Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{{Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.: "meh", Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.: "something", Timescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Time.: timescip-go gomod github.com/golang/go/src go1.16 time/.Nowscip-go gomod github.com/golang/go/src go1.16 time/Now().()}}, Mutex: &syncscip-go gomod github.com/golang/go/src go1.16 sync/.Mutexscip-go gomod github.com/golang/go/src go1.16 sync/Mutex#{}}, |
| 277 | args: args{tag: "tag with empty data", data: nil}, |
| 278 | }, |
| 279 | } |
| 280 | for _, tt := range tests { |
| 281 | t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 282 | p := &EventPoolscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#{ |
| 283 | Mutexscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Mutex.: tt.fields.Mutex, |
| 284 | debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#debug.: tt.fields.debug, |
| 285 | silentscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#silent.: tt.fields.silent, |
| 286 | eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.: tt.fields.events, |
| 287 | listenersscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#listeners.: tt.fields.listeners, |
| 288 | } |
| 289 | eventsList := tt.fields.events[:] |
| 290 | // It's prepended |
| 291 | eventsList = append([]Eventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#{{Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.: tt.args.tag, Datascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Data.: tt.args.data}}, eventsList...) |
| 292 | p.Addscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Add().(tt.args.tag, tt.args.data) |
| 293 | t.Logfscip-go gomod github.com/golang/go/src go1.16 testing/common#Logf().("eventsList : %+v", eventsList) |
| 294 | for index, e := range eventsList { |
| 295 | if e.Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag. != p.eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.[index].Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag. { |
| 296 | t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("Tag mismatch, got %s want %s", p.eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#events.[index].Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag., e.Tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Event#Tag.) |
| 297 | } |
| 298 | } |
| 299 | }) |
| 300 | } |
| 301 | } |