Cloned actions

This commit is contained in:
Regis
2016-11-25 17:31:44 +01:00
parent 21575ef782
commit 0e306e59b8
2 changed files with 8 additions and 9 deletions

View File

@@ -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
}

View File

@@ -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))
}
}