Fixed panic for ping methods in dispatchers

This commit is contained in:
porosnicuadrian
2021-03-31 18:11:17 +03:00
committed by Dan Christian Bogos
parent d58e231beb
commit fe506d48d4
29 changed files with 210 additions and 20 deletions

View File

@@ -224,7 +224,10 @@ type CGREvents struct {
}
func NewCGREventWithArgDispatcher() *CGREventWithArgDispatcher {
return new(CGREventWithArgDispatcher)
return &CGREventWithArgDispatcher{
CGREvent: new(CGREvent),
ArgDispatcher: new(ArgDispatcher),
}
}
type CGREventWithArgDispatcher struct {

View File

@@ -447,11 +447,14 @@ func TestCGREventConsumeArgs(t *testing.T) {
}
func TestNewCGREventWithArgDispatcher(t *testing.T) {
eOut := new(CGREventWithArgDispatcher)
rcv := NewCGREventWithArgDispatcher()
exp := &CGREventWithArgDispatcher{
CGREvent: new(CGREvent),
ArgDispatcher: new(ArgDispatcher),
}
eOut := NewCGREventWithArgDispatcher()
if !reflect.DeepEqual(eOut, rcv) {
t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
if !reflect.DeepEqual(eOut, exp) {
t.Errorf("Expecting: %+v, received: %+v", eOut, exp)
}
}