Skip to content

Commit

Permalink
Example for issue #24.
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Mar 9, 2016
1 parent 65847ea commit ea01514
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion mergo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"reflect"
"testing"
"time"

"gopkg.in/yaml.v1"
)

Expand Down Expand Up @@ -523,3 +522,26 @@ func TestUnexportedProperty(t *testing.T) {
}()
Merge(&a, b)
}

type structWithBoolPointer struct {
C *bool
}

func TestBooleanPointer(t *testing.T) {
bt, bf := true, false
src := structWithBoolPointer{
&bt,
}
dst := structWithBoolPointer{
&bf,
}
if err := Merge(&dst, src); err != nil {
t.FailNow()
}
if dst.C == src.C {
t.Fatalf("dst.C should be a different pointer than src.C")
}
if *dst.C != *src.C {
t.Fatalf("dst.C should be true")
}
}

0 comments on commit ea01514

Please sign in to comment.