Skip to content

Commit

Permalink
PR review clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
svyotov committed Jan 12, 2020
1 parent 697a693 commit 7e445ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
20 changes: 7 additions & 13 deletions issue90_test.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package mergo

import (
"reflect"
"testing"

"github.com/magiconair/properties/assert"
)

func TestMergoSimpleMap(t *testing.T) {
dst := map[string]string{"key1": "loosethis", "key2": "keepthis"}
src := map[string]string{"key1": "key10"}
exp := map[string]string{"key1": "key10", "key2": "keepthis"}
err := Merge(&dst, src, WithAppendSlice, WithOverride)
assert.Equal(t, err, nil)
assert.Equal(t, dst, exp)
}

type CustomStruct struct {
SomeMap map[string]string
}
Expand Down Expand Up @@ -50,7 +40,11 @@ func TestMergoStructMap(t *testing.T) {
exp := data.exp

err := Merge(&dst, src, WithAppendSlice, WithOverride)
assert.Equal(t, err, nil)
assert.Equal(t, dst, exp)
if err != nil {
t.Errorf("mergo error was not nil, %v", err)
}
if !reflect.DeepEqual(dst, exp) {
t.Errorf("Actual: %#v did not match \nExpected: %#v", dst, exp)
}
}
}
1 change: 0 additions & 1 deletion merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func deepMerge(dstIn, src reflect.Value, visited map[uintptr]*visit, depth int,
k := dstElement.Interface()
dstElement = reflect.ValueOf(k)
}
// dstElement.Set(reflect.ValueOf())

switch srcElement.Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice:
Expand Down

0 comments on commit 7e445ff

Please sign in to comment.