-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathissue23_test.go
More file actions
31 lines (25 loc) · 628 Bytes
/
issue23_test.go
File metadata and controls
31 lines (25 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package mergo_test
import (
"testing"
"time"
"dario.cat/mergo"
)
type document struct {
Created *time.Time
}
func TestIssue23MergeWithOverwrite(t *testing.T) {
now := time.Now()
dst := document{
&now,
}
expected := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
src := document{
&expected,
}
if err := mergo.MergeWithOverwrite(&dst, src); err != nil {
t.Errorf("Error while merging %s", err)
}
if !dst.Created.Equal(*src.Created) { //--> https://golang.org/pkg/time/#pkg-overview
t.Errorf("Created not merged in properly: dst.Created(%v) != src.Created(%v)", dst.Created, src.Created)
}
}