mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Cloned actions
This commit is contained in:
@@ -749,10 +749,11 @@ func (apl Actions) Sort() {
|
||||
sort.Sort(apl)
|
||||
}
|
||||
|
||||
func (apl *Actions) Clone() (interface{}, error) {
|
||||
//cln := new(Actions)
|
||||
if err := utils.Clone(*apl, cln); err != nil {
|
||||
func (apl Actions) Clone() (Actions, error) {
|
||||
|
||||
var cln Actions
|
||||
if err := utils.Clone(apl, &cln); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return interface{}(cln), nil
|
||||
return cln, nil
|
||||
}
|
||||
|
||||
@@ -2338,7 +2338,7 @@ func TestClonedAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClonedActions(t *testing.T) {
|
||||
actions := &Actions{
|
||||
actions := Actions{
|
||||
&Action{
|
||||
Id: "RECUR_FOR_V3HSILLMILLD1G",
|
||||
ActionType: TOPUP,
|
||||
@@ -2367,10 +2367,8 @@ func TestClonedActions(t *testing.T) {
|
||||
t.Error("error cloning actions: ", err)
|
||||
}
|
||||
|
||||
clonedActions := clone.(*Actions)
|
||||
|
||||
if !reflect.DeepEqual(actions, clonedActions) {
|
||||
t.Error("error cloning actions: ", utils.ToIJSON(clonedActions))
|
||||
if !reflect.DeepEqual(actions, clone) {
|
||||
t.Error("error cloning actions: ", utils.ToIJSON(clone))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user