Skip to content

Commit

Permalink
Issue #123 closed
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed May 17, 2020
1 parent b73121e commit 9080aaf
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions issue123_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package mergo

import (
"testing"
)

func TestIssue123(t *testing.T) {
src := map[string]interface{}{
"col1": nil,
"col2": 4,
"col3": nil,
}
dst := map[string]interface{}{
"col1": 2,
"col2": 3,
"col3": 3,
}

// Expected behavior
if err := Merge(&dst, src, WithOverride); err != nil {
t.Fatal(err)
}
testCases := []struct {
key string
expected interface{}
}{
{
"col1",
nil,
},
{
"col2",
4,
},
{
"col3",
nil,
},
}
for _, tC := range testCases {
if dst[tC.key] != tC.expected {
t.Fatalf("expected %v in dst[%q], got %v", tC.expected, tC.key, dst[tC.key])
}
}
}

0 comments on commit 9080aaf

Please sign in to comment.