Package list golang-github-imdario-mergo / 5a44df57-ad70-4d2f-8aa5-d3d88e4eaa4f/upstream issue83_test.go
5a44df57-ad70-4d2f-8aa5-d3d88e4eaa4f/upstream

Tree @5a44df57-ad70-4d2f-8aa5-d3d88e4eaa4f/upstream (Download .tar.gz)

issue83_test.go @5a44df57-ad70-4d2f-8aa5-d3d88e4eaa4f/upstreamraw · history · blame

package mergo_test

import (
	"testing"

	"github.com/imdario/mergo"
)

type issue83My struct {
	Data []int
}

func TestIssue83(t *testing.T) {
	dst := issue83My{Data: []int{1, 2, 3}}
	new := issue83My{}
	if err := mergo.Merge(&dst, new, mergo.WithOverwriteWithEmptyValue); err != nil {
		t.Error(err)
	}
	if len(dst.Data) > 0 {
		t.Errorf("expected empty slice, got %v", dst.Data)
	}
}